I'm not sure how to preserve the state of the message queue between
instantiations of the application.

To take the example of my app, I have a Service that starts a
background thread. It creates a Handler for that thread which is
subsequently used by Activities to post messages for background
processing. Now, what happens if Android decides to kill the process
while there are still messages in the queue? The onDestroy() method of
the Service seems like the right place to deal with this, by, say,
stopping the looper and the background thread, and then saving any
unprocessed messages into persistent storage, so that when the Service
is recreated it can prepopulate the queue with the saved messages.

But looking at the API for Handler, Looper, and MessageQueue it's not
obvious how I can do this. What is the right way to save this state?

--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to