I've home screen widget with ListView inside (Android 4.x - ICS), and after some change the listed items are not correctly displayed - I mean, the "old" data are displayed. Its always in this way:
- visible part of listview has ALWAYS good (= new) data displayed
- invisible part of list (scroll up or down) ALWAYS shows some of items old (and some not)
It looks, like the not visible part of list is cached, and when I scroll up or down, only few items are refreshed, and other not. And it looks funny, because when I'm scrolling up and down, some items are showing old, some new, and always different items, like absolutely randomly. It's simple strange...
What's the problem? Here is my ListView:
<ListView
android:id="@+id/panelNews"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/padding"
android:layout_marginRight="@dimen/padding"
android:layout_weight="1"
android:gravity="top"
android:paddingTop="@dimen/padding"
android:scrollingCache="false"
android:animationCache="false">
</ListView>
And here is code of my MyWidgetServiceFactory method (this method is fired on each data change):
public void onDataSetChanged() {
MyLogger.log(TAG, "onDataSetChanged");
listItems = dbHandler.getRecords(prefHandler);
}
And this is how I notify MyWidgetServiceFactory about data change from my UpdateService:
AppWidgetManager manager = AppWidgetManager.getInstance(this);
int[] appWidgetIds = manager.getAppWidgetIds(new ComponentName(this, MyWidget.class));
manager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.panelNews);