问题描述
我用的是commit方法在我的项目,该项目建成它的碎片。
I was using the commit method in my project that built it with fragments.
反正,有时我得到IllegalStateException异常:不能执行后的onSaveInstanceState此操作的错误,我无法找到什么好solutoin只是这种方法commitAllowingStateLoss。我改承诺的功能commitAllowingStateLoss但没有用它长的时间来测试,可能这个功能帮助我吗?而最主要的问题有什么区别悫提交和commitAllowingStateLoss?
Anyway, sometimes I was getting "IllegalStateException: Can not perform this action after onSaveInstanceState" error and I couldn't find any good solutoin about it but just this method commitAllowingStateLoss. I changed commit function to commitAllowingStateLoss but didn't use it long time to test so may this function help me? And the main question what is the difference betwen commit and commitAllowingStateLoss?
感谢。
推荐答案
关于这个问题,你可以在这里阅读:http://stackoverflow.com/a/10261438/1749429
About this problem you could read here: http://stackoverflow.com/a/10261438/1749429
这是提交(差)将执行之前的活动保存其状态,而commitAllowingStateLoss()执行。欲了解更多详情请看这里:http://developer.android.com/reference/android/support/v4/app/FragmentTransaction.html#commit()
The difference that commit() will execute before activity saves its state whereas commitAllowingStateLoss() execute after saving. For more details see here: http://developer.android.com/reference/android/support/v4/app/FragmentTransaction.html#commit()
这篇关于在片段提交和commitAllowingStateLoss之间的区别是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!