Any idea how to pevent a listview displayed in an Android Widget to fliker every time data is refreshed?

60 Views Asked by At

I'm displaying a widget with a listview. When I need to refresh the listview data I'm calling the following code

appWidgetManager.notifyAppWidgetViewDataChanged(widgetIds, R.id.list);

This works fine except that the listview flickers a lot every time this is called. Is there a way to prevent this?

EDIT: After doing a lot of test it looks like the flickering only happens when I display an imageview in the listview rows using the following code

view.setImageViewBitmap(R.id.thumbnail, bitmap);
1

There are 1 best solutions below

0
user1026605 On BEST ANSWER

For some reasons using

views.setImageViewUri(R.id.thumbnail, uri);

instead of

view.setImageViewBitmap(R.id.thumbnail, bitmap);

fixes the issue. No more flickering when refreshing the listview content of a widget