So I'm writing an app. I would like to be able to press the home key to leave the app, do something else for a moment, then come back to the app by picking it from the launcher. I want the app to have exactly the same state as it did when I left it. To this end, I have implimented onSaveInstanceState() to create a bundle, and I use this bundle in onCreate() (checking if it is null, of course).
This is what I would expect to happen...
-I install the app from Eclipse
-I launch the app from the launcher
-I press the home key
-onSaveInstanceState() is caled, I write a bundle
-I launch the app again from the launcher
-onCreate() is called, I get the bundle I previously wrote
-I use that bundle to restore my ui
This is what happens though...
-I install the app
-I launch the app from the launcher
-I press the home key
-onSaveInstanceState() is called, bundle is written
-I launch the app again
-onCreate() is called WITHOUT my bundle
-What appears to have happened is that a new activity has been put onto the stack for this task.
-I press the back button
-The activity I just launched is destroyed, and the activity i launched first is displayed, with the correct state!
-Repeat pressing back until back at the homescreen
-The lifecycle now works as expectecd! Even after a reboot, but it fails when I install a new version of the app
What could possibly be doing this, ONLY after installation!