(1) I use fragment, OnStop but without OnDestroy switch (replace) fragment times Java.lang.IllegalStateException:Can not perform this Action after onsaveinstancestate error, the cause of the problem occurs, Is that I use Fragmenttransaction.commit, the solution: using Fragmenttransaction.commitallowingstateloss will not be an error
(2) This error occurred when using fragment today Illegalstateexception:can not perform this action after Onsaveinstancestate:
This action after onsaveinstancestate at Android.support.v4.app.FragmentManagerImpl.checkStateLoss ( Fragmentmanager.java:1314) at android.support.v4.app.FragmentManagerImpl.enqueueAction ( Fragmentmanager.java:
is in the use of Fragmenttransition's Commit method to add a fragment, and later found on the official website of the relevant
Description: Http://developer.android.com/reference/android/app/FragmentTransaction.html#commitAllowingStateLoss ()
public abstract int commitallowingstateloss () Added in API level 11
Like but allows, the commit to being executed after an activity's is commit() saved. This was dangerous because the commit can be lost if the activity needs to later being restored from it state, so this should Only being used for cases where it's okay for the UI state to change unexpectedly on the user.
Basically it means that the commit method I'm using is called after the activity's Onsaveinstancestate (), which makes an error, because
The Onsaveinstancestate method is called before the activity is about to be destroyed, to save the activity data, if you save the play state
Adding fragment to it will make a mistake. The solution is to replace the commit () method with Commitallowingstateloss ().
, the effect is the same.
Reference URL: http://blog.csdn.net/acetech_sean/article/details/9275485
Http://www.cnblogs.com/zgz345/archive/2013/03/04/2942553.html
Java.lang.IllegalStateException:Can not perform this action after onsaveinstancestate problem resolution