In my AppWidgetProvider, I do following:
@Override
public void onReceive(Context ctx, Intent intent) {
final String action = intent.getAction();
if (action.equals(NEXTPAGE_ACTION)) {
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(ctx);
RemoteViews rv = new RemoteViews(ctx.getPackageName(), R.layout.widget_layout);
rv.setViewVisibility(R.id.page1, View.GONE);
rv.setViewVisibility(R.id.page2, View.VISIBLE);
final int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
appWidgetManager.updateAppWidget(appWidgetId, rv);
}
}
Although I'm updating the layout via updateAppWidget, the change is not really reflected on the UI. What could be possibly going wrong? Thanks much!