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);
Use AppWidgetManager.getAppWidgetInfo() as in
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
AppWidgetProviderInfo appWidgetManager.getAppWidgetInfo(widgetid);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With