Take a look at the Fragment docs over at Android's developer site. In their example they show clearly how to save state here. For ease of use I'll copy here :).
Basically, you have to check for saved state in onActivityCreated and save any desired info in onSaveInstanceState as follows:
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
.....
if (savedInstanceState != null) {
// Restore last state for your player information.
mIsPlaying = savedInstanceState.getBoolean("isPlaying", false);
}
......
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean("isPlaying", mIsPlaying);
}