Search code examples
androidandroid-listviewwidgetandroid-remoteview

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


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);

Solution

  • 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