java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
来源:互联网 发布:淘宝卖家威胁要上门 编辑:程序博客网 时间:2024/05/17 03:46
这个错是提示:不要在onSaveInstanceState之后来这个操作。
我是在改变fragment时出现的这个错误。、
解决办法是,把commit(),改成commitAllowingStateLoss();
在官方文档上有这样一段话。
A transaction can only be committed with this method prior to its containing activity saving its state. If the commit is attempted after that point, an exception will be thrown. This is because the state after the commit can be lost if the activity needs to be restored from its state. See commitAllowingStateLoss() for situations where it may be okay to lose the commit.
这个方法只能在保存activity状态之前来进行事务处理,否则会抛异常。这是因为提交后的状态会丢失,但是activity需要恢复状态。commitAllowingStateLoss()这方法适合可能会丢失commit的情况。
1 0
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException:Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState问题解决
- Fragment解决java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- Fragment java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- 有关对象初始化和向前引用
- vim之记录功能
- React Native 二:在ubuntu MATE 16.04 下搭建React Native 开发环境
- NSDecimalNumber的使用
- Java反射Demo
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- org.apache.hadoop.fs.ChecksumException:Checksum error
- hdu5119 DP
- eclipse突然运行变慢
- Sitemesh3 的使用及配置
- android中carrier表示什么
- 极光推送(二):自定义推送消息
- 基础排序算法
- SpringMVC 解决IE8浏览器把返回报文格式application/json当文件下载的问题