android - IllegalStateException - fragment 支持库

标签 android illegalstateexception

我的应用程序在某些用户设备上不断崩溃,在 Activity onStart 方法中出现以下异常:

Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1299)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1310)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:541)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:525)
at android.support.v4.app.DialogFragment.show(DialogFragment.java:123) 

我无法在我的模拟器中本地重现此错误。我在stackoverflow上发现了一些关于这个问题的问题: herehere

我已经尝试了建议的解决方案,即在 onSaveInstance 中不允许在 fragment 或 Activity 中使用空包。

但是问题仍然存在。这是我收到的唯一一份崩溃报告,而且我不断收到它。

有人有可行的解决方案吗?

最佳答案

我已经解决了这个问题

在此处查看我的答案以获取代码:"Can not perform this action after onSaveInstanceState" - why am I getting this exception from my activity's onResume method?

到目前为止没有更多的 IllegalStateException。

关于android - IllegalStateException - fragment 支持库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11900785/

相关文章:

java - 还有一个 mediaPlayer IllegalStateException : screen timeout

java - Android 服务或 Activity 可以知道哪个 Intent 打开了它吗?

android - monkeyrunner.press 的第三个参数是什么

android - Android P 预览版 toast View 的 IllegalStateException

java - 安卓 - java.lang.IllegalStateException : cannot perform this action after onSaveInstanceState

java - jcombobox 作为单元格编辑器 java.awt.IllegalComponentStateException : component must be showing on the screen to determine its location

android - 我怎样才能使多个复选框下拉列表成为选中状态

android - 如何在 void 方法上做 doNothing()?

android - 如何为 Android 模拟器控件准备 KML 文件?

java - 准备 MediaPlayer 播放自定义文件时出现问题