Fragment提交commit时候异常(Can not perform this action after onSaveInstanceState)
来源:互联网 发布:如何避免无聊闲谈知乎 编辑:程序博客网 时间:2024/06/13 18:13
A界面是FragmentActivity 然后在fragment里面启动了Activity B,在B结束finish()的时候,广播给FragmentActivity 切换fragment,这个时候会抱上面的异常。
原因:
你只能在activity处于可保存状态的状态时,比如running中,onPause()方法和onStop()方法中提交事务,否则会引发异常。这是因为fragment的状态会丢失。
解决办法:
如果要在可能丢失状态的情况下提交事务,请使用commitAllowingStateLoss()。效果是一样的。
0 0
- Fragment提交commit时候异常(Can not perform this action after onSaveInstanceState)
- 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
- FragmentTransaction commit 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
- mysqldump备份
- head first设计模式之单例模式 c++解读
- IOS 正则表达式
- 主打隐形技术 路虎全新SUV概念车将亮相
- Javascript:this用法整理
- Fragment提交commit时候异常(Can not perform this action after onSaveInstanceState)
- android webview 正常显示 Html中的 iframe和frame
- H3C交换机典型(ACL)访问控制列表配置实例
- 八大排序算法源码 + 耗时长度比较
- Objective-C在ARC下结合GCD的单例模式和宏模版
- JAVA SSH 框架介绍
- TCP/IP
- 分布式发布订阅消息系统 Kafka (A distributed publish-subscribe messaging system)
- Android HorizontalScrollView 实例