java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState解决?
做项目到最后整合的时候测试的时候发现 切换tab更换fragment的时候抛出了这个异常,根据异常信息Can not perform this action after onSaveInstanceState,
定位到:
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager
.beginTransaction();
transaction
.replace(R.id.ll_content, new SellerFragment());
transaction.commit();
可以了解到异常原因:在onSaveInstanceState行为之后,app执行某个不能响应的行为而导致异常发生。也许你并没有用saveInstance手动的保存当前的状态但是也报了这个错误。
然后有人说:
把
transaction.commit();
方法替换成
transaction.commitAllowingStateLoss()就行
了,其效果是一样的。然后试了下果真解决了。
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState解决?的更多相关文章
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState问题解决
(1)我用的是fragment,在onStop但是没有onDestroy的情况下切换(replace)fragment时报 java.lang.IllegalStateException: Can n ...
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
在使用Fragment的过程中,常常会遇到在Activity的onSaveInstanceState方法调用之后,操作commit或者popBackStack而导致的crash. 因为在onSaveI ...
- 解决IllegalStateException: Can not perform this action after onSaveInstanceState
今天使用Fragment的时候,出现了这个错误 IllegalStateException: Can not perform this action after onSaveInstanceState ...
- 【转】 解决IllegalStateException: Can not perform this action after onSaveInstanceState
今天使用Fragment的时候,出现了这个错误 IllegalStateException: Can not perform this action after onSaveInstanceState ...
- 解决IllegalStateException: Can not perform this action after onSaveInstanceState:
今天做项目中的支付宝功能,是在fragment中做的,在支付成功后,想切换到支付成功的页面. 结果就报错了IllegalStateException: Can not perform this act ...
- IllegalStateException: Can not perform this action after onSaveInstanceState
http://www.cnblogs.com/zgz345/archive/2013/03/04/2942553.html 今天使用Fragment的时候,出现了这个错误 IllegalStateEx ...
- Android 错误:IllegalStateException: Can not perform this action after onSaveInstanceState
今天做Fragment切换.状态保存功能的时候,出现了这个错误: E/AndroidRuntime(12747): Caused by: java.lang.IllegalStateException ...
- [Android Pro] java.lang.IllegalStateException: Fragment(XXFragment) not attached to Activity异常
转载:http://blog.csdn.net/winson_jason/article/details/20357435 下边两个问题,是在开发中碰到的一些关于Fragment的偶发性的问题,今天时 ...
- Can not perform this action after onSaveInstanceState
java.lang.RuntimeException: Unable to resume activity {com.tongyan.nanjing.subway/com.tongyan.struct ...
随机推荐
- hduoj------2594 Simpsons’ Hidden Talents
Simpsons’ Hidden Talents Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java ...
- 初始jQuery
JQuery是继prototype之后又一个优秀的Javascript库.它是轻量级的js库 ,它兼容CSS3,还兼容各种浏览器(IE 6.0+, FF1.5+, Safari 2.0+, Opera ...
- Java集合涉及的类(代码)
Customer: public class Customer implements Comparable{ private Integer customerId; pri ...
- ...python の 学习
5.14 ...上次学python 好像是一个月前.. 写点东西记录下叭.. 现在在看李老大写的博客写..可能直接开抄代码... 感觉自己写的总是爬不成功,之前写的爬豆瓣影评的爬虫还是残的... 1. ...
- css改变图片的颜色
参考大神张鑫旭:http://www.zhangxinxu.com/wordpress/2016/06/png-icon-change-color-by-css/ 主要知识点:border-right ...
- linux shell 单引号 双引号 反引号的区别
一.单引号和双引号 首先, 单引号和双引号,都是为了解决中间有空格的问题. 因为空格在linux中时作为一个很典型的分隔符,比如 string1=this is a string,这样执行就会报错.为 ...
- gitlab配置邮件通知
配置用户提交评论.添加issue等的邮件通知: Gitlab邮件提醒方便跟踪项目进度,在这里介绍两种方式,一种是用系统的sendmail发送邮件,另一种是GMAIL的stmp来发送邮件 第一种 用系统 ...
- 关于jquery计算页面元素数量
这段jquery计算页面元素数量代码,能不能刷新页面直接输出数量,而不用点计算按钮 <scriptsrc="http://ajax.googleapis.com/ajax/libs/j ...
- 两天以来对plsqldev操作的记忆
frist,开机后,打开服务,打开服务,打开服务(重要的事情说三遍). and then, 打开plsqldev,输入TEST账户而不是SYS账户,否则你会被许多未接触到的内容淹没你刚刚创建好的表. ...
- The bundle does not contain an app icon for iPhone / iPod Touch of exactly '57x57' pixels
遇到这个问题问题,搜索了一圈要么不知道,要么喊改deploymenet target, 最后我是在项目属性-info-icon files(ios5)-下面添加了一个icon,然后弄了个icon.pn ...