That's not a bad idea actually, but that would mean i'd have to keep tabs on all the stuff myself...
What i'm doing now is using a Handler for the snooze time (don't want to mix AlarmManager alarms with the app's own alarms). Each Activity instance has its own Handler, so when the Runnable is run i'm in the context of that activity instance. This Activity (and its potentially multiple instances) is started by the AlarmReceiver with startActivity(). Everything is actually pretty cool, if it wasn't for this focus issue. The activities take care of themselves and destroy their own stuff when it's time. Making them act as a single activity, by populating UI fields according to what happens, i would have to keep record of all the handlers and runnables, and compared to what i have now i'm not sure it's worth the extra effort. On Sun, Aug 29, 2010 at 4:23 PM, Mark Murphy <[email protected]>wrote: > I'm not sure how you would be able to identify which instance to bring > to the front, if they are all the same activity. > > Have you considered updating your flow, such that the second alarm > brings the existing activity instance to the front, which then > displays snooze/dismiss options for both alarms? > > On Sun, Aug 29, 2010 at 9:14 AM, Teo [GD API Guru] <[email protected]> > wrote: > > i have multiple instances of the same activity, is there a way to > > programatically bring one of the instances to the front? I've read > > some existing threads and it seems there's no way to do this... My > > specific use case is of a Snooze/Dismiss type of screen. The problem > > would appear when the user sets 2 alarms close by: > > - first alarm is triggered, so first instance of the activity is > > created > > - user doesn't dismiss the alarm > > - second alarm is triggered, so the second activity instance is > > created and comes to the front > > - user doesn't dismiss this either > > - first activity instance reminds the user about the first alarm > > (sound can be played, but the UI is still somewhere in the background) > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9 > Available! > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- *Teo* Site <http://teodorfilimon.com> | Blog <http://teodorfilimon.blogspot.com/> | Facebook <http://www.facebook.com/teominator> | Twitter<http://twitter.com/teominator> Romania, Europe (GMT +2) -- 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

