I have a case where my onRestoreInstanceState() is properly called, but for some reason, the prior onSaveInstanceState() is not.
The situation is that I have an Activity that starts another activity. The device is in portrait at this time. While the other activity is active, the device is rotated. It then finishes, returning to my activity. Since the orientation has changed, my activity is destroyed and recreated. However, I am never getting my onSaveInstanceState() method called before the call to destroy. I see the following:
finish (prior activity) onDestroy (my activity) onCreate onRestoreInstanceState onResume
And then of course, I trip over an NPE and crash.
If I simply rotate while my activity is up, I get the OnSaveInstanceState() call as I expected. Just not when it is switching back to my activity from the other activity.
Is this a known issue or is there something else that I can do to work around this?