做项目到最后整合的时候测试的时候发现  切换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解决?的更多相关文章

  1. java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState问题解决

    (1)我用的是fragment,在onStop但是没有onDestroy的情况下切换(replace)fragment时报 java.lang.IllegalStateException: Can n ...

  2. java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

    在使用Fragment的过程中,常常会遇到在Activity的onSaveInstanceState方法调用之后,操作commit或者popBackStack而导致的crash. 因为在onSaveI ...

  3. 解决IllegalStateException: Can not perform this action after onSaveInstanceState

    今天使用Fragment的时候,出现了这个错误 IllegalStateException: Can not perform this action after onSaveInstanceState ...

  4. 【转】 解决IllegalStateException: Can not perform this action after onSaveInstanceState

    今天使用Fragment的时候,出现了这个错误 IllegalStateException: Can not perform this action after onSaveInstanceState ...

  5. 解决IllegalStateException: Can not perform this action after onSaveInstanceState:

    今天做项目中的支付宝功能,是在fragment中做的,在支付成功后,想切换到支付成功的页面. 结果就报错了IllegalStateException: Can not perform this act ...

  6. IllegalStateException: Can not perform this action after onSaveInstanceState

    http://www.cnblogs.com/zgz345/archive/2013/03/04/2942553.html 今天使用Fragment的时候,出现了这个错误 IllegalStateEx ...

  7. Android 错误:IllegalStateException: Can not perform this action after onSaveInstanceState

    今天做Fragment切换.状态保存功能的时候,出现了这个错误: E/AndroidRuntime(12747): Caused by: java.lang.IllegalStateException ...

  8. [Android Pro] java.lang.IllegalStateException: Fragment(XXFragment) not attached to Activity异常

    转载:http://blog.csdn.net/winson_jason/article/details/20357435 下边两个问题,是在开发中碰到的一些关于Fragment的偶发性的问题,今天时 ...

  9. Can not perform this action after onSaveInstanceState

    java.lang.RuntimeException: Unable to resume activity {com.tongyan.nanjing.subway/com.tongyan.struct ...

随机推荐

  1. (08)odoo继承机制

    * 全局的引用    所有的的模型定义外,都在注册中心注册了,我们可以用全局变量来引用这些模型    self.env[mode name] 比如得到合作伙伴这个模型 self.evn['res.pa ...

  2. Linux下如何查看自己的服务器有没有无线网卡

    还是实验室那台破服务器,连不上网.有没有界面,所以想着如何用一些命令来链接上热点. 当然,在linux下链接wifi没有win下那么一点就好了! 首先我们需要的基本条件就是: 服务器上有无线网卡.[r ...

  3. Scout YYF I(POJ 3744)

    Scout YYF I Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5565   Accepted: 1553 Descr ...

  4. ie6 ie7 绝对定位 相对定位 层被遮住

    relative 上加上z-index有多个,则z-index递减, absolute层显示则不会被其它标签挡住.

  5. php -l 检查文件是否语法错误

    有时候在进行网页开发的时候,后台文件的语法错误比较难检查出来,这时候使用php -l filename可对文件的语法进行检查.

  6. c# 关键字delegate、event(委托与事件)[MSDN原文摘录][1]

    A delegate is a type that safely encapsulates a method, similar to a function pointer in C and C++. ...

  7. mysql用户备份与修复

    1.修复表repair table tb1 [use frm]; #红色部分代表可添加也可不加, 2.show variables like '%timeout%';  #查询关键字 3. 更改数据, ...

  8. Entity Framework系列

    这个系列主要记录学习EF的过程和碰到的问题以及解决问题的方法. EF中的那些批量操作 EF的Model First

  9. 在 CentOS 7 中安装并使用自动化工具 Ansible

    Ansible是一款为类Unix系统开发的自由开源的配置和自动化工具.它用Python写成,类似于Chef和Puppet,但是有一个不同和优点是我们不需要在节点中安装任何客户端.它使用SSH来和节点进 ...

  10. bzoj 1951: [Sdoi2010]古代猪文

    #include<cstdio> #include<iostream> #include<cstring> #include<cmath> #defin ...