jason wrote: > How does one then save and restore the application state when > the Back key is pressed and then the application is brought to > foreground?
When the BACK button is pressed, the currently-running activity is destroyed, not put in the background. If you wish to save something when the activity is being destroyed, implement onDestroy() and save it. Where you save it (flat file, SharedPreferences, database, the Internet) is up to you. Bear in mind that onDestroy() may also be called in the case of a screen rotation or other configuration change, since, by default, the current activity is destroyed and started in that case. > The Bundle value in onCreate is null (perhaps because > onSaveInstanceState was not called when Back was clicked. More accurately, the Bundle is null because the application is starting from scratch. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training in Germany, 18-22 January 2010: http://bignerdranch.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" 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-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

