I'm using a GridView in an AppWidget, and I'm having a problem with its view recycling. RemoteViewsFactory doesn't have any way to deal with recycled views as far as I can tell, the getView
method only has an index, no convertView to use. So, when my GridView recycles a view, it retains all the same data as the original occurrence of it, and this is wrong. Is there any way I can disable the view recycling, or edit the recycled view to replace its data?
At first I thought to just return a different viewtype for each index, but RemoteViewsFactory hides that too, so I can't do that either!
I think I figured it out. When I'm creating the list of views that will populate the adapter used by the GridView, I just clear all views before putting the data into it. I have no idea why it works, but it seems to.
RemoteViews view = new RemoteViews( _context.getPackageName(), R.id.base_view );
view.removeAllViews( R.id.day_box );