I have an appwidget that I\'m trying to update from an activity.
To do that, I need the appwidget id.
I\'ve used AppWidgetManager.getAppWidgetIds
bu
You can access your widget without knowing id
appWidgetManager.updateAppWidget(new ComponentName(this.getPackageName(),Widget.class.getName()), views);
This let you access the widget without having to know the 'appWidgetID'. Then in activity:
Intent intent = new Intent(this, Settings.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
views.setOnClickPendingIntent(R.id.btnActivate, pendingIntent);
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(this);
appWidgetManager.updateAppWidget(new ComponentName(this.getPackageName(), Widget.class.getName()), views);
finish();