Android 解决java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState异常
来源:互联网 发布:bat的程序员什么水平 编辑:程序博客网 时间:2024/05/16 15:31
项目中偶现如图所示错误信息,我们可以根据错误提示发现,此提示意思是说我们不能再onSaveInstanceState()
方法后调用commit()
。那么我们什么时候会在onSaveInstanceState()
后调用commit()
呢?举个例子:当我们的Activity
处于后台时调用了commit()
这个时候就会报上图所示的错误信息。我们可以将commit()
替换成commitAllowingStateLoss()
便可解决此问题。既然说是偶现的那如果有小伙伴想调试此错误,我们可以写个延迟,先将Activity
挂到后台再调用commit()
就会出现此错误信息了。哈哈!
阅读全文
0 0
- Android 解决java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState异常
- 解决Fragment偶发异常java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- 解决Fragment偶发异常java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- Android 异常java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- 解决异常IllegalStateException: Can not perform this action after onSaveInstanceState
- IllegalStateException: Can not perform this action after onSaveInstanceState 异常解决
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException:Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
- 如何使用dos命令关闭正在运行程序
- ++ --
- Android RxJava2.0的简单使用
- Spark成长之路(5)-消息队列
- day08-JavaWeb之http协议request-response
- Android 解决java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState异常
- tensorflow1.1/循环神经网络手写数字啊识别
- URL长链接转短链接
- [译]The Python Tutorial#8. Errors and Exceptions
- 斐波那契数列
- Java语言高编——面向对象-抽象类
- 清除Adnroid (安卓)手机微信浏览器的缓存
- bugku ctf 一段base64 wirteup
- ListView的使用