No a kill for memory definitely does not remove activities from the stack. That is the whole reason for onSaveInstanceState et al to exist -- so when the user returns to the activity, and it needs to be recreated because its process had been killed, that it can properly restore itself to its previous state.
For the original question, you should put whatever state you need to retain in onSaveInstanceState(), and retrieve from the state passed to onCreate(). If this is a large amount of data, hopefully you can just put in an identifier or something for it in the state, and reconstruct the data in onCreate(). Also fwiw "Low Memory: No more background processes" isn't directly tied to a process getting killed for memory -- this is just the activity manager detecting that for whatever reason there are no more running background processes. You will find background processes killed far more often than you see the message printed. On Mon, Nov 23, 2009 at 4:48 PM, Mark Murphy <[email protected]>wrote: > Mark Wyszomierski wrote: > > If I follow the lifecycle docs correctly, an Activity won't get > > notified if it's force killed for memory? > > Correct. In a true "force kill" scenario, Android needs RAM quickly and > cannot rely upon you to do something quickly. > > > But was does onDestroy() get called, so we have a > > chance to clean up? Or do we just have to write safeguards in onCreate > > () to check for a force-kill as mentioned in this post?: > > > > > http://groups.google.com/group/android-developers/browse_thread/thread/1b342cd8f940d98c/0958bfede0b2b87a?lnk=gst&q=kill+low+memory#0958bfede0b2b87a > > You should never assume that static data, like a singleton, exists, > unless it is final (i.e., never modified). onDestroy() may or may not be > called, etc. > > That being said, I had kinda assumed, in the case of a force-kill of > your process for memory reclamation, your activity would also be removed > from the stack. If your scenario is indeed what's happening, that > implies that your app's activities remain on the stack despite the > force-kill, which surprises me. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > Android Development Wiki: http://wiki.andmob.org > > -- > 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 > -- 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

