I have an app widget with a configure activity, and I want to trigger an update to the widget when an OK button in the activity is clicked. I wrote this code:
Intent initialUpdateIntent=new Intent(AppWidgetManager.
ACTION_APPWIDGET_UPDATE);
initialUpdateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
widgetID);
sendBroadcast(initialUpdateIntent);
But for some reason the onUpdate function is not called! Does anyone know what the problem might be? Thanks.
Do you try to to catch your broastcast message in onReceive:
Otherwise, IMO it is better to define your own Message rather than using ACTION_APPWIDGET_UPDATE to clearly logic of update view of widget, something like that, in 1.Declare intent name in Manifest file:
2.Define intent name:
3.Handle in onReceive:
Hope it help ^^
Try the following:
Replace DayActivitiesAppWidget with your
AppWidgetProvider
class this way u update all your widget instances, then you can track down the issue with updating a single widget instance.