Android App Widget manually update does not work after it is updated when the app is installed

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Android App Widget manually update does not work after it is updated when the app is installed



I have the following code executed when a fragment is created. However, after the widget is updated once, it cannot be updated again.


AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(getContext());
RemoteViews remoteViews = new RemoteViews(getContext().getPackageName(), R.layout.recipe_appwidget);
ComponentName thisWidget = new ComponentName(getContext(), RecipeAppWidgetProvider.class);
Intent intent = new Intent(getContext(), RecipeWidgetService.class);
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
remoteViews.setRemoteAdapter(R.id.listViewWidget, intent);
remoteViews.setEmptyView(R.id.listViewWidget, R.id.empty_view);
int appWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget);
appWidgetManager.updateAppWidget(thisWidget, remoteViews);
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.layout.recipe_appwidget);









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results