I have a nested Fragment that I am trying to restore the state given an orientation change.
So firstly my setup is as follows:
Activity -> ParentFragment (SetRetainInstance(true)) -> ChildFragment
In My Child fragment I have the onSaveInstance code as follows:
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// Serialize the current dropdown position.
outState.putInt(STATE_SELECTED_NAVIGATION_ITEM, getActivity().getActionBar()
.getSelectedNavigationIndex());
}
However when I orientate the device in all the LifeCycle events return a savedInstance state of null.
Am I doing this incorrectly for a ChildFragment? Why is my state not getting saved and returned?