fragment使用时 Can not perform this action after onSaveInstanceState
来源:互联网 发布:申请淘宝商家披露信息 编辑:程序博客网 时间:2024/06/04 18:26
在我们使用fragment的时候有时候会遇到Can not perform this action after onSaveInstanceState错误.总所周知,onSaveInstanceState()函数是在activity被回收以后调用来保存activity的状态的,如果在保存玩状态后再给它添加Fragment就会出错,因此我们有两种方式来处理这样的问题.
- 1.重写onSaveInstanceState()函数然后将super方法去掉(注意参数的个数).
@Overrideprotected void onSaveInstanceState(Bundle outState) { //No call for super(). Bug on API Level > 11.}
- 2.第二种方式就是在使用FragmentTransition不使用 commit方法而是使用另外的一个函数:commitAllowingStateLoss.
transaction.commitAllowingStateLoss();
0 0
- fragment使用时 Can not perform this action after onSaveInstanceState
- 解决Fragment IllegalStateException: Can not perform this action after onSaveInstanceState
- Fragment IllegalStateException: Can not perform this action after onSaveInstanceState
- Fragment 出现Can not perform this action after onSaveInstanceState
- fragment 异常IllegalStateException: Can not perform this action after onSaveInstanceState
- Can not perform this action after onSaveInstanceState(fragment异常)
- Fragment错误:IllegalStateException: Can not perform this action after onSaveInstanceState
- Fragment Or DialogFragment Can not perform this action after onSaveInstanceState
- Fragment Can not perform this action after onSaveInstanceState
- Fragment Or DialogFragment Can not perform this action after onSaveInstanceState
- Fragment中出现Can not perform this action after onSaveInstanceState
- 解决fragment错误 Can not perform this action after onSaveInstanceState
- fragment/dialogfragment异常:Can not perform this action after onSaveInstanceState
- Fragment坑之Can not perform this action after onSaveInstanceState
- Fragment系列之Can not perform this action after onSaveInstanceState
- Fragment异常:Can not perform this action after onSaveInstanceState
- Fragment Can not perform this action after onSaveInstanceState
- 解决Fragment中:Can not perform this action after onSaveInstanceState
- 13.子查询返回多行多列的数据
- linux下的一个小程序--模拟进度条
- Python 数据库操作
- 解决Dev-c++不能调试的方法
- php __FILE__ __DIR__魔术常量的使用
- fragment使用时 Can not perform this action after onSaveInstanceState
- 基于TCP的RPC
- Maven私服问题汇总
- Oracle创建表空间、创建用户以及授权
- CSS选择器
- 判断一个文件格式是否是日期格式
- Android-BitmapFactory.decodeResource OOM问题
- MySQL语句基础之数据库约束
- angularJS 练习