Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single Configuration Activity for multiple Homescreen Widgets

Tags:

android

I have one Configuration Activity for different Hoomescreen Widgets for my Android App.

I get the WidgetId in the Configuration Activity like this:

widgetid = extras.getInt(
       AppWidgetManager.EXTRA_APPWIDGET_ID, 
       AppWidgetManager.INVALID_APPWIDGET_ID);

But later in the code I want to know which WidgetProvider class has called the Configuration Activity. How can i do this?

P.S.

I've found the answer:

AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
AppWidgetProviderInfo appWidgetManager.getAppWidgetInfo(widgetid);
like image 614
imehl Avatar asked Jun 13 '12 09:06

imehl


1 Answers

Use AppWidgetManager.getAppWidgetInfo() as in

AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
AppWidgetProviderInfo appWidgetManager.getAppWidgetInfo(widgetid);
like image 190
whynot Avatar answered Oct 27 '22 00:10

whynot