Reputation: 4157
I wrote a widget that sits on my home screen.
There is also a configuration activity which can be started from the widget or from the launcher.
When started from launcher, I don't have the widget id.
Is it possible to find it somehow?
The reason is that I want to send an update message from the activity to the widget.
Upvotes: 5
Views: 7732
Reputation: 176
Something like this seems to work for me:
Context context = getApplicationContext();
ComponentName name = new ComponentName(context, MyWidgetProvider.class);
int [] ids = AppWidgetManager.getInstance(context).getAppWidgetIds(name);
Upvotes: 16