1

I have a widget with 2 different OnClick intents, and they both work as expected. Except after an acore restart. I think it has something to do with my pendingintent not getting refreshed after the restart.

Can anyone help me with this issue?

This is from my onRecieve()

        final RemoteViews views = new RemoteViews(context.getPackageName(), layoutID);
    views.setOnClickPendingIntent(R.id.TopRow, PendingIntent.getActivity(context, 0, new Intent(context, DigiClock.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), PendingIntent.FLAG_UPDATE_CURRENT));
    AppWidgetManager.getInstance(context).updateAppWidget(intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS), views);
    alarmClockIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(alarmClockIntent);
tristan202
  • 1,081
  • 3
  • 19
  • 28

1 Answers1

0

As I've written here you should only produce a single instance of the RemoteView, and share it within the class.

Community
  • 1
  • 1
Glitch
  • 2,785
  • 1
  • 27
  • 50