IllegalStateExceptionの解決:Can not perform this action after onSaveInstanceState



今日Fragmentを使用していると、このエラーが発生しました.IllegalStateException:Can not perform this action after onSaveInstanceState:
E/AndroidRuntime(12747): Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState  
    at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1314)  
    at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1325)  
FragmentTransitionのcommitメソッドを使用してFragmentを追加したときに現れ、その後公式サイトで関連を見つけた.
説明:http://developer.android.com/reference/android/app/FragmentTransaction.html#commitAllowingStateLoss()
public abstract int commitAllowingStateLoss ()
Added in  API level 11
Like  commit()  but allows the commit to be executed after an activity's state is saved. This is dangerous because the commit can be lost if the activity needs to later be restored from its state, so this should only be used for cases where it is okay for the UI state to change unexpectedly on the user.
私が使っているcommitメソッドはActivityのonSaveInstancesState()の後に呼び出されます.これはエラーです.
onSaveInstanceStateメソッドは、Activityが破棄される前に呼び出され、Activityデータを保存します.
Fragmentを追加するとエラーが発生します.解決策はcommit()メソッドをcommitAllowingStateLoss()に置き換えればよい
はい、その効果は同じです.