title: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState while using FragmentTabHost
body: <p>I am trying create a tabbed activity using the below code 
  <code></p>
  
  <pre><code>public class FragmentTabs extends FragmentActivity {
  
  private FragmentTabHost mTabHost;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
      mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
  
      mTabHost.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"),
              SimpleFrag.class, null);
  
      mTabHost.addTab(mTabHost.newTabSpec("detailed").setIndicator("Detailed"),
              DetailedFrag.class, null);
  
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  }    
  </code></pre>
  
  <p></code></p>
  
  <p>The code always shows 
  <code>java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState</code> inside FragmentManager. I googled seveal times and goes through almos all the links. but i can't get any solution. Please help me because i'm stuck on this.
  </p>
  
  <p>------------------------------------------------------Edit---------------------------------</p>
  
  <p>The above code working fine sometimes and throws exception sometimes.</p>