public void onSaveInstanceState(Bundle outState){
  outState.putInt(EXTRA_TAG_COUNT,mTagCount);
  outState.putInt(EXTRA_SELECTED_TAB_INDEX,mSelectedTabIndex);
  if (mCurrentFrag != null) {
    outState.putString(EXTRA_CURRENT_FRAGMENT,mCurrentFrag.getTag());
  }
  try {
    final JSONArray stackArrays=new JSONArray();
    for (    Stack<Fragment> stack : mFragmentStacks) {
      final JSONArray stackArray=new JSONArray();
      for (      Fragment fragment : stack) {
        stackArray.put(fragment.getTag());
      }
      stackArrays.put(stackArray);
    }
    outState.putString(EXTRA_FRAGMENT_STACK,stackArrays.toString());
  }
 catch (  Throwable t) {
  }
}

public void onSaveInstanceState ( Bundle outState ) { outState . putInt ( EXTRA_TAG_COUNT , mTagCount ) ; outState . putInt ( EXTRA_SELECTED_TAB_INDEX , mSelectedTabIndex ) ; if ( mCurrentFrag != null ) { outState . putString ( EXTRA_CURRENT_FRAGMENT , mCurrentFrag . getTag ( ) ) ; } try { final JSONArray stackArrays = new JSONArray ( ) ; for ( Stack < Fragment > stack : mFragmentStacks ) { final JSONArray stackArray = new JSONArray ( ) ; for ( Fragment fragment : stack ) { stackArray . put ( fragment . getTag ( ) ) ; } stackArrays . put ( stackArray ) ; } outState . putString ( EXTRA_FRAGMENT_STACK , stackArrays . toString ( ) ) ; } catch ( Throwable t ) { } }
call this in your activity ' s onsaveinstancestate ( bundle outstate ) method to save the instance ' s state .
