I have a Widget that needs to be populated with dynamic content.
Specifically I'd like it to contain a ViewFlipper whose Views are updated at runtime.
I'm not clear on how to access the ViewFlipper from the onUpdate method of my AppWidgetProvider
(assuming this is the correct place to affect change on the Widget and all the examples I'm finding on-line deal with static layouts that have all their elements defined in the xml).
So...
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
//in pseudo code I'm looking for something that lets me do this...
**(ViewFlipper) vf = remoteViews.findViewById(R.id.myFlipper);**
//EDIT:
//based on commonsware's suggestion... I'm here...
ImageView stationView = (ImageView)((Activity)context).getLayoutInflater().inflate(R.layout.widget_station, null);
//how what?
pushWidgetUpdate(context, remoteViews);
}
However, RemoteViews
doesn't have such a method, so, I'm perplexed as to how to handle this. I see according to the docs that Widgets support ViewFlippers... but do they not support populating them dynamically?