Fragment异常:Can not perform this action after onSaveInstanceState
来源:互联网 发布:淘宝中差评修改步骤 编辑:程序博客网 时间:2024/05/29 16:55
原因:在你离开当前Activity等情况下,系统会调用onSaveInstanceState()帮你保存当前Activity的状态、数据等,直到再回到该Activity之前(onResume()之前),你执行Fragment事务,就会抛出该异常!
解决方法:
1、使用commitAllowingStateLoss()方法提交。但是有可能导致该次提交无效.
2、在重新回到该Activity的时候(onResumeFragments()或onPostResume()),再执行该事务.
support-26.0.0开始,Fragment以及FragmentManager提供了isStateSaved(),可以判断宿主是否已经执行过onSaveInstanceState()
阅读全文
0 0
- fragment 异常IllegalStateException: Can not perform this action after onSaveInstanceState
- Can not perform this action after onSaveInstanceState(fragment异常)
- fragment/dialogfragment异常:Can not perform this action after onSaveInstanceState
- Fragment异常:Can not perform this action after onSaveInstanceState
- 解决Fragment IllegalStateException: Can not perform this action after onSaveInstanceState
- Fragment IllegalStateException: Can not perform this action after onSaveInstanceState
- Fragment 出现Can not perform this action after onSaveInstanceState
- Fragment错误:IllegalStateException: Can not perform this action after onSaveInstanceState
- Fragment Or DialogFragment Can not perform this action after onSaveInstanceState
- Fragment Can not perform this action after onSaveInstanceState
- Fragment Or DialogFragment Can not perform this action after onSaveInstanceState
- Fragment中出现Can not perform this action after onSaveInstanceState
- 解决fragment错误 Can not perform this action after onSaveInstanceState
- fragment使用时 Can not perform this action after onSaveInstanceState
- Fragment坑之Can not perform this action after onSaveInstanceState
- Fragment系列之Can not perform this action after onSaveInstanceState
- Fragment Can not perform this action after onSaveInstanceState
- 解决Fragment中:Can not perform this action after onSaveInstanceState
- 原生JDBC开发详解及问题总结(一)
- CC_SYNTHESIZE的使用
- String判断是否为空注意问题
- opencv机器学习
- PHP常用正则实例
- Fragment异常:Can not perform this action after onSaveInstanceState
- 华为手机打开日志开关
- java 中使用ScriptEngine执行javascript脚本代码和使用中应该注意的事项
- Installation failed with message Failed to establish session. It is possible that this issue is reso
- yaf框架学习第一篇hello world
- Android获取SHA1和MD5值
- HDU-1875-畅通工程再续
- 【LeetCode】463. Island Perimeter
- 习题 2.4(1) 有两个瓶子A和B, 分别盛放醋和酱油,要求将它们互换(即A瓶原来盛醋,现在改盛酱油,B瓶则相反)。