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 ...
随机推荐
- Eclipse上安装GIT插件EGit
一.Eclipse上安装GIT插件EGit Eclipse的版本eclipse-java-helios-SR2-win32.zip(在Eclipse3.3版本找不到对应的 EGit插件,无法安装) E ...
- Eclipse启动tomcat 报“ A child container failed during start”
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]] at org.ap ...
- groovy基础
字符串字面值 def age=25 log.info 'My age is ${age}' log.info "my age is \${age}" log.info " ...
- 报错解决:No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
大概分析一般使用了注解才会报这方面的错 1.没有在spring的ApplicationContext.xml中开启注解事务 <!-- 开启注解事务 --> <tx:annotatio ...
- 安卓手机修改host
电脑修改 注意:usb设置为调试模式 1.手机必须先root,小米可以安卓开发版系统即可 2.安卓 adb工具(android debug bridge) 3.依次执行下面的命令 1.adb root ...
- javascript中的defer和async学习+javascript执行顺序
一.defer和async 我们常用的script标签,有两个和性能.js文件下载执行顺序相关的属性:defer和async defer的含义[摘自https://developer.mozilla. ...
- JSP生成条形码
下载barcode4j-2.0-bin.zip 目前最新版本是2.0, 解压barcode4j-2.0-bin.zip, 将其中的\lib\avalon-amework-4.2.0.jar和\bui ...
- 使用strace工具故障排查的5种简单方法
使用strace工具故障排查的5种简单方法 本文源自5 simple ways to troubleshoot using strace strace 是一个非常简单的工具,用来跟踪可执行程序的系统调 ...
- 如何对ConnectionString进行加密解码?
这个就不说了就是一个类 public static class EncryptionConfig { /* 加密配置节点 * Response.Write(EncryptionConfig.Encry ...
- qt--- vs
qt with vs 1.安装vs2012: 2.下载Qt 5.2.0 for Windows 32-bit (VS 2012, 579 MB) 和 Visual Studio Add-in 1.2. ...