New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Activity.onBackPressed()的时候抛出Can not perform this action after onSaveInstanceState的异常 #490
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
项目中所使用的Fragment都是v4包里的。而且调用的都是
commitAllowingStateLoss()
方法。之前发现线上的用户在结束Activity的时候会在v4包的FragmentManagerImpl里面抛出Can not perform this action after onSaveInstanceState的异常。看源码的时候发现是因为
mStateSaved=true
导致的,所以就简单的调了一下FragmentActivity的onStateNotSaved()
方法,在销毁之前讲mStateSaved设置为false但是更新之后,发现用户仍然会报这个crash。FragmentActivity的
onBackPressed()
会走到Activity的onBackPressed()
方法,在这个方法中最终会调用android.app.FragmentManagerImpl.checkStateLoss()
,同样会抛出Can not perform this action after onSaveInstanceState的异常。而之前的onStateNotSaved()
只修改了v4包里Fragment的mStateSaved的值。想问一下有没有什么简单的方法可以避免这个异常,或者帮忙分析一下为何会抛出这个异常。目前搜索到的答案都与这种情况不同
The text was updated successfully, but these errors were encountered: