I have a simple appWidget that displays an image. The image is selected in the configuration activity and the widget is updated via the remove view. This is done on a button push executing the code below:
Intent intent = new Intent(context, KidDialog.class);
intent.setData(selectedImage);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
widgetView.setOnClickPendingIntent(R.id.centerBrd, pendingIntent);
widgetView.setImageViewUri(R.id.widImg, selectedImage);
appWidgetManager.updateAppWidget(appWidgetId, widgetView);
Intent resultValue = new Intent();
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
setResult(RESULT_OK, resultValue);
finish();`
As you can see, it is also seeing an PendingIntent for the onClickListener of the image. I don't think that is relevant here. Anyway, this work great. The widget does exactly what I want it to. Until I restart the device.
When I restart the widget loads with the default view from the xml in the apk. It does not keep the image update from the initial configuration. My questions is how do I get the widget to load back up after a restart with the updated view set during the configuration activity? I will also need to reset the onClick Pendingintent, but I will save that for later. I expect they are related anyway. So I am out of ideas.