I have run into some trouble lately with onSaveInstanceState()
and onRestoreInstanceState()
. I have multiple activities that use these methods to save state in the case that they are cleaned up by the system. Most of them work, except for one, and I have no idea why.
What specifically happens is this:
- I have my emulator running, and the dev tools setup to
destroy()
all activities when they are no longer visible. (So that I can prove that save/restore are working properly.) - The Activity in question is started up, and I proceed to change some of its state.
- I start a new Activity, let it run for a moment, and then use the 'back' button to go to my previous Activity.
- Upon arriving back at the Activity in question, I notice that the default state is back, thus, it does not have the state it should.
I have noticed that the onSaveInstanceState()
is called, onCreate()
is called, but has a null bundle, and onRestoreInstanceState()
is never called.
Has anyone seen this before?