在执行片段事务时出错,它显示错误checkStateLoss

时间:2013-08-28 05:45:29

标签: fragmenttransaction

我收到通知,点击通知

调用SherlockFragmentActivity
public class MainActivity extends SherlockFragmentActivity{

      @Override
      protected void onNewIntent(Intent intent) {
      super.onNewIntent(intent);
      Log.e(TAG, "========onNewIntent");
      Fragment fragment = null;

      if(intent == null)
        return;

      String intentAction = intent.getAction();
      Log.e(TAG, "========onNewIntent"+intentAction);

      if (!intentAction.equalsIgnoreCase(SipManager.ACTION_SIP_HOME)) {
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        if(intentAction.equalsIgnoreCase(SipManager.ACTION_SIP_MESSAGES)){
            fragment = new ConversationsListFragment();
        }

        fragment.setArguments(null);
        ft.replace(R.id.main_frag_content, fragment);
        getSupportFragmentManager().popBackStack();
        ft.commit();
       }

    if(intentAction.equalsIgnoreCase(SipManager.ACTION_SIP_HOME)){
        Log.e(TAG, "========ACTION_SIP_HOME"+intentAction);
        return;
    }
}

}

清单文件是:

<activity
        android:name="com.name.ui.tablet.MainActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:screenOrientation="sensorLandscape"
        android:theme="@style/DarkTheme.NoTitle"
        android:windowSoftInputMode="adjustPan" >

        <intent-filter android:priority="10" >
            <action android:name="com.name.phone.action.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

        <intent-filter android:priority="10" >
            <action android:name="com.name.phone.action.Chat" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

        <intent-filter android:priority="10" >
            <action android:name="com.name.phone.action.CALLS" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

    </activity>

我收到错误

08-28 11:08:29.531: E/AndroidRuntime(18195): FATAL EXCEPTION: main
08-28 11:08:29.531: E/AndroidRuntime(18195): java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
08-28 11:08:29.531: E/AndroidRuntime(18195): at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1299)

0 个答案:

没有答案