On Sun, Aug 29, 2010 at 6:59 AM, Teo <[email protected]> wrote:

> That's not a bad idea actually, but that would mean i'd have to keep tabs
> on all the stuff myself...


You really don't want to avoid keeping track of what you are doing.
 Throwing stuff up into the system and hoping it all comes down in the right
pieces is probably not going to work so well.

Just keep persistent state about what your own app is actually doing, and
drive your interaction with the system through that.


> 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.
>

What you are doing is actually going to break on you, as soon as your
process gets killed while it is in the background.

You need to keep this stuff in persistent state, and explicitly manage it.

-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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

Reply via email to