One option is to leverage setData() when building the PendingIntent to include something unique about the button being pressed.
j On Wed, Sep 30, 2009 at 2:45 PM, sdphil <[email protected]> wrote: > > i have an app widget that has a couple of buttons on it, and in my > onUpdate() call, I am hooking up the buttons to do something when you > press them -- > > RemoteViews remoteViews = new > RemoteViews(context.getPackageName > (), R.layout.appwidget); > remoteViews.setOnClickPendingIntent(R.id.Button1, > button1PendingIntent); > remoteViews.setOnClickPendingIntent(R.id.Button2, > button2PendingIntent); > > The problem is that when I click on button2, it sends the button1 > pending intent. i think that's because it's reusing the pending > intent. > > http://groups.google.com/group/android-developers/browse_thread/thread/5605471d73a250ba > > "If the creating application later re-retrieves the same kind of > PendingIntent (same operation, same Intent action, data, categories, > and components, and same flags), it will receive a PendingIntent > representing the same token if that is still valid, and can thus call > cancel() to remove it." > > So then the question is, how do I communicate which button was > pressed? > > tia. > > > -- Jeff Sharkey [email protected] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

