IllegalStateException: Can not perform this action after onSaveInstanceState
http://www.cnblogs.com/zgz345/archive/2013/03/04/2942553.html
今天使用Fragment的时候,出现了这个错误 IllegalStateException: Can not perform this action after onSaveInstanceState:
- E/AndroidRuntime(12747): Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1314)
- at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1325)
是在使用FragmentTransition的 commit方法添加一个Fragment的时候出现的,后来在官网找到了相关的
public abstract int commitAllowingStateLoss ()
Like commit() but allows the commit to be executed after an activity's state is saved. This is dangerous because the commit can be lost if the activity needs to later be restored from its state, so this should only be used for cases where it is okay for the UI state to change unexpectedly on the user.
大致意思是说我使用的 commit方法是在Activity的onSaveInstanceState()之后调用的,这样会出错,因为
onSaveInstanceState方法是在该Activity即将被销毁前调用,来保存Activity数据的,如果在保存玩状态后
再给它添加Fragment就会出错。解决办法就是把commit()方法替换成 commitAllowingStateLoss()就行
了,其效果是一样的。
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 action after onSaveInstanceState ...
- 解决IllegalStateException: Can not perform this action after onSaveInstanceState:
今天做项目中的支付宝功能,是在fragment中做的,在支付成功后,想切换到支付成功的页面. 结果就报错了IllegalStateException: Can not perform this act ...
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState问题解决
(1)我用的是fragment,在onStop但是没有onDestroy的情况下切换(replace)fragment时报 java.lang.IllegalStateException: Can n ...
- Android 错误:IllegalStateException: Can not perform this action after onSaveInstanceState
今天做Fragment切换.状态保存功能的时候,出现了这个错误: E/AndroidRuntime(12747): Caused by: java.lang.IllegalStateException ...
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState解决?
做项目到最后整合的时候测试的时候发现 切换tab更换fragment的时候抛出了这个异常,根据异常信息Can not perform this action after onSaveInstance ...
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
在使用Fragment的过程中,常常会遇到在Activity的onSaveInstanceState方法调用之后,操作commit或者popBackStack而导致的crash. 因为在onSaveI ...
- Can not perform this action after onSaveInstanceState
java.lang.RuntimeException: Unable to resume activity {com.tongyan.nanjing.subway/com.tongyan.struct ...
- android异常:Can not perform this action after onSaveInstanc
extends:http://zhiweiofli.iteye.com/blog/1539467 本人某个android项目开发阶段一直运行良好,直到上线前夕,在某款跑着android 4.03系统的 ...
随机推荐
- 网络抓包神器-Charles使用指南
http://blog.csdn.net/liulanghk/article/details/46342205 目录 概述 安装 显示模式 PC端抓包 移动应用抓包 其他技能 charles使用问题汇 ...
- Linux 管道
管道命令 " | ",竖线符号代表的就是管道符 管道是一种两个进程间进行单向通信的机制.因为管道传递数据的单向性,所以又称为半双工管道. 介绍: 管道可以根据一组命令按照数据流向的 ...
- DNS的服务器和客户端的配置
内网环境Linux发行版本均采用centos为主,centos下DNS服务端的搭建步骤如下: DNS master节点搭建步骤: 安装组件: yum install bind; yum in ...
- appium入门级教程(1)—— appium介绍
appium介绍 官方网站与介绍 1.特点 appium 是一个自动化测试开源工具,支持 iOS 平台和 Android 平台上的原生应用,web应用和混合应用. “移动原生应用”是指那些用iOS或者 ...
- spring mvc activemq
http://websystique.com/spring/spring-4-jms-activemq-example-with-jmslistener-enablejms/
- mysql5.6.34在默认配置文件修改字符集为utf8后重启mysql服务没效果
1:事情是这样的,我下载了一个mysql5.6.34版本(windows版本的),下载下来后里面只有个my-default.ini,然后我就直接在my-default.ini 里面配置basedir, ...
- Codeforces Round #475 (Div. 2) C - Alternating Sum
等比数列求和一定要分类讨论!!!!!!!!!!!! #include<bits/stdc++.h> #define LL long long #define fi first #defin ...
- 【noip模拟赛2】牛跳
描述 John的奶牛们计划要跳到月亮上去.它们请魔法师配制了P(1 <= P <=150,000)种药水,这些药水必需安原来的先后次序使用,但中间可以跳过一些药水不吃.每种药水有一个“强度 ...
- Db2与Oracle的区别
这个部分是自己随便整理下. 在工作上需要,公司需要DB2兼容Oracle. 不懂DB2与Oracle的细节,这里努力整理,以后精通了再回来重新修改. https://www.2cto.com/data ...
- 为什么sql里面not in后面的子查询如果有记录为NULL的,主查询就查不到记录
为什么sql里面not in后面的子查询如果有记录为NULL的,主查询就查不到记录???原因很简单: SELECT * FROM dbo.TableA AS a WHERE a.id NOT IN ( ...