Jake,
You have the widget id where you're building your RemoteViews and
setting the PendingIntent for the click.
So the only thing is how to get the widget id into the PendingIntent, so
you can retrieve it later in the config activity.
Probably the easiest way is to use the same extra,
AppWidgetManager.EXTRA_APPWIDGET_ID, as used for new widgets. Or some
other, as you see fit.
To make sure that you get multiple PendingIntent objects, each with its
own widgetId, you can use unique reqestId values with
PendingIntent.getActivity, such as the widget Id itself.
Intent intent = new Intent(context, WidgetConfigActivity.class);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
PendingIntent pending = PendingIntent.getActivity(context,
widgetId, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
updateViews.setOnClickPendingIntent(R.id.widget_top_level,
pendingIntent);
Might be a good idea to cancel unneeded pending intents somewhere in
Widget.onDeleted.
-- Kostya
03.05.2011 17:12, Jake Colman пишет:
Kostya,
I've been noodling around thinking about this problem while working on
other features but I'm stumped on one part of it. When the Preference
Activity is launched as a Configuration Activity the intent contains
widget ID. But I can also launch the same Activity if the user touches
the widget so that the user can reconfigure the widget even after it has
been installed. In that situation, how can I know which widget is being
reconfigured? The widget ID is not part of the widget itself so I don't
how I can grab the ID of the specific widget that is being reconfigured.
...Jake
--
Kostya Vasilyev -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en