2

I've got parent and child activities. Parent activity stores custom state in onSaveInstanceState (super.onSaveInstanceState is called after all needed items are packed into bundle) and then the state is read in onCreate however savedInstanceState is always null for some reason.

Here is sequence of logged events on parent activity: onPause->onSaveInstanceState->onStop. Then child activity gets shown and when I press Up, parent activity fires onDestroy, then onCreate with null savedInstanceState.

I'm kind of out of ideas on the matter - please advise what I might be missing.

Thanks.

NeviQ-OR
  • 305
  • 2
  • 12
  • The answer http://stackoverflow.com/questions/10320179/android-actionbar-up-button-versus-system-back-button indirectly resolved my problem but still I'd like to understand logic behind behavior I'm observing. – NeviQ-OR May 03 '14 at 08:18
  • Great that you problem is solved. However, for us to explain to you what's happening, we need more info. What is your code and how did you exactly solve it? – nhaarman May 03 '14 at 08:41

1 Answers1

4

I am facing the same issue. My solution is change ParentActivity launch mode in manifest from default to

android:launchMode="singleTop"
MysticMagicϡ
  • 28,593
  • 16
  • 73
  • 124
Hafiz Waleed Hussain
  • 1,062
  • 12
  • 25