My app widget functions in a number of modes. For each of these modes, I created a RemoteViewsFactory
. To switch between modes, I send an intent to my AppWidgetProvider
. Upon receiving it, I create the RemoteViews
and pass it to AppWidgetManager
's updateAppWidget()
. To set a RemoteViewsFactory
for a collection view, I call RemoteViews
' setRemoteAdapter()
:
rv.setRemoteAdapter(appWidgetId, R.id.widget_view_flipper, intent);
R.id.widget_view_flipper
is the collection view, intent
is for RemoteViewsService
to construct the appropriate factory.
EDIT: I edited the question because I figured out the originally described problem. Now it's that when I change factories, getViewAt()
of the new factory is called after the change, but the element in the collection view simply doesn't update! How would that happen?
For now the only thing I've come up with is that I can call AppWidgetManager's notifyAppWidgetViewDataChanged with a delay after the factory replacement, it causes the element in the view to update with an ugly blinking.