I have the following situation:
- Activity A starts activity B
- Activity A calls
onPause
,onSaveInstanceState
andonStop
methods. - On activity B I press the "UP button" on the action bar
- Activity A first gets destroyed (calls
onDestroy
) and then recreated. (This just seems to happen this way. I have not implemented this way, just seems to be the Android way of doing things ..) - During the
onCreate
method, the variablesavedInstanceState
is always null.
I know there have been similar topics around here, but none of them seem to have an answer for my situation. All the callback methods have log lines in them, so I'm certain that the save method is executed and destory is executed. But why is there never a savedInstanceState
object?
My save method:
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
savedInstanceState.putSerializable(OpenSessionsActivity.SESSION, session);
System.out.println("saving ..");
super.onSaveInstanceState(savedInstanceState);
}
Is there any other code you need me to include?