Multiple Instances Of Widget Only Updating Last Widget
Posted by tech on
September 26, 2011
This took me awhile to figure it out because whenever I navigate using the buttons in one of the widget, it affects all other instances of that widget. But thankfully, some forum member in Stack Overflow named snailer provided a solution to making each Intent object unique per instance of an Android widget.
Just add the following code to your Intent object.
1 2 | Uri data = Uri.withAppendedPath(Uri.parse(URI_SCHEME + "://widget/id/"), String.valueOf(appWidgetId)); intent.setData(data); |
The variable URI_SCHEME is a String, and can be whatever you would like. ie - “ABCD” This causes each widget to have a unique PendingIntent.
Donations appreciated. Every little $ helps. Or click Google +1









