Can not perform this action after onSaveInstanceState

来源:互联网 发布:java 启动main方法 编辑:程序博客网 时间:2024/05/21 13:56

今天在用到fragment的时候闪退报错,Can not perform this action after onSaveInstanceState

原因是我在结束一个activity后返回给主activity然后更改了fragment.

commit方法一定要在Activity.onSaveInstance()之前调用

最后把commit替换成commitAllowingStateLoss

还没来得及看源码,看完了再写上来

0 0
原创粉丝点击