[android-developers] Activities from widget

2011-04-28 Thread Niall
I have a widget with a few buttons. I want one button to open preferences, and the second to start an AlarmManager according to the preferences that have been set. A click of either button on the widget will go the same activity, but I wish to distinguish between the clicks via extra

Re: [android-developers] Activities from widget

2011-04-28 Thread Mark Murphy
You will need to use two distinct Intents, ones that route to the same activity but differ by something more than just the extras. For example, on one, add an action string that you won't be using. It will not affect the routing (you're specifying the class name, which trumps everything else). On

Re: [android-developers] Activities from widget

2011-04-28 Thread Kostya Vasilyev
Probably the easiest way is to use two distinct action string values. Another way is to use two distinct request codes when you create PendingIntent objects: one for each operation. So you'd have: PendingIntent pendingIntentForPrefs = PendingIntent.getActivity( context, 1, intentForPrefs,

Re: [android-developers] Activities from widget

2011-04-28 Thread Niall
Thanks for the quick replies, you two! I got it working :) Kostya's solution seemed quickest to use so I tried that. I think it was the setting of the different values of the second parameter to getActivity that did it. Does this make sense? I had two pendingIntent.getActivity( context, 0,

Re: [android-developers] Activities from widget

2011-04-28 Thread Kostya Vasilyev
28.04.2011 19:14, Niall ?: Thanks for the quick replies, you two! I got it working :) Cool. Kostya's solution seemed quickest to use so I tried that. I think it was the setting of the different values of the second parameter to getActivity that did it. Does this make sense? I had two