title: Switch tab onNewIntent cause IllegalStateException
body: <p>My FragmentActivity(singleTop) is giving me IllegalStateException if I try to switch the navigation tab in the onNewIntent method. </p>
  
  <p>More specifically, My application use SherlockActionBar with three tabs, one tab is updated when a push notification is received (and the intent is called), if the App was suspended on another tab, when I receive the intent (in the onNewIntent) I change the tab (and therefore the fragment) to the third tab with bar.setSelectedNavigationItem() and this is causing me the problem. If the app was suspended on the third tab, no exception occurs.</p>
  
  <p>Code:</p>
  
  <pre><code>@Override
      public void onNewIntent(Intent intent) {
          super.onNewIntent(intent);
          Bundle bundle = intent.getExtras();
          if (bundle != null) {
              bar.setSelectedNavigationItem(Utils.ORDER_STATUS_TAB_ID);
          } else {
          }
      } 
  </code></pre>
  
  <p>The push notification intent:</p>
  
  <pre><code>    Intent notificationIntent = new Intent(context,
              MainActivity.class);
      notificationIntent.putExtra("orderUpdate",
              new Gson().toJson(orderUpdate));
      notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
              | Intent.FLAG_ACTIVITY_SINGLE_TOP);
      PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
              notificationIntent, 0);
  
      notification.contentIntent = contentIntent;
  </code></pre>
  
  <p>The TabListener method (with the comment on the line 56 in the stacktrace) </p>
  
  <pre><code>@Override
      public void onTabSelected(Tab tab, FragmentTransaction ft) {
          ft = activity.getSupportFragmentManager().beginTransaction();
          ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
          if (mFragment == null) {
              mFragment = Fragment
                      .instantiate(activity, mClass.getName(), mArgs);
              ft.add(android.R.id.content, mFragment, tag);
              ft.commit();
          } else {
              ft.attach(mFragment);
              ft.commit(); // line 56
          }
  </code></pre>
  
  <p>The detailed exception:</p>
  
  <pre><code>07-12 20:06:40.959: E/AndroidRuntime(8639): java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
  07-12 20:06:40.959: E/AndroidRuntime(8639):     at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1299)
  07-12 20:06:40.959: E/AndroidRuntime(8639):     at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1310)
  07-12 20:06:40.959: E/AndroidRuntime(8639):     at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:541)
  07-12 20:06:40.959: E/AndroidRuntime(8639):     at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:525)
  07-12 20:06:40.959: E/AndroidRuntime(8639):     at com.wizche.ui.MyTabListener.onTabSelected(MyTabListener.java:56)
  07-12 20:06:40.959: E/AndroidRuntime(8639):     at com.actionbarsherlock.internal.app.ActionBarImpl.selectTab(ActionBarImpl.java:526)
  07-12 20:06:40.959: E/AndroidRuntime(8639):     at com.actionbarsherlock.internal.app.ActionBarImpl.setSelectedNavigationItem(ActionBarImpl.java:317)
  07-12 20:06:40.959: E/AndroidRuntime(8639):     at com.wizche.MainActivity.onNewIntent(MainActivity.java:205)
  </code></pre>