IllegalStateException异常 - 片段支持库 [英] IllegalStateException - Fragment support library

查看:209
本文介绍了IllegalStateException异常 - 片段支持库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的应用程序continously崩溃对一些用户的设备有以下例外的活动OnStart方法一个严重的问题:

I have a serious problem with my App continously crashing on some users devices with the following exception in an Activity onStart method:

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) 

我不能在本地在我的模拟器重现此错误。我发现对这个问题的计算器上的几个问题:   <一href="http://stackoverflow.com/questions/7469082/getting-exception-illegalstateexception-can-not-perform-this-action-after-onsa/10261438#10261438"标题=点击这里>此处和   <一href="http://stackoverflow.com/questions/7575921/illegalstateexception-can-not-perform-this-action-after-onsaveinstancestate-h">here

I cannot reproduce this error locally in my emulator. I have found a few questions regarding this issue on stackoverflow: here and here

我已经尝试了建议的解决方案,即不允许在onSaveInstance空包既不片段,也没有活动。

I have tried the suggested solution, i.e. do not allow empty bundles in onSaveInstance neither in fragments nor activities.

但问题依然存在。这是唯一的崩溃报告,我得到了,我得到它continously。

However the problem remains. This is the only Crash report I ever get, and I get it continously.

没有人有一个有效的解决方案?

Does anyone have a working solution?

推荐答案

我已经通过

  • upgrading my support lib to revision 10
  • using workaround posted here: http://code.google.com/p/android/issues/detail?id=23096 i.e.. Add a non-ui fragment in onResumeFragments and invoke further transactions in Listener Callback.

在这里查看我的回答为code:<一href="http://stackoverflow.com/questions/12450024/can-not-perform-this-action-after-onsaveinstancestate-why-am-i-getting-this/12681526#12681526">"Can不执行的onSaveInstanceState&QUOT后,这个动作; - 为什么我会收到此异常从我的活动的onResume方法

Check my answer here for code: "Can not perform this action after onSaveInstanceState" - why am I getting this exception from my activity's onResume method?

没有得到更多的IllegalStateException异常为止。

Got no more IllegalStateException so far.

这篇关于IllegalStateException异常 - 片段支持库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆