获得一个java.lang.IllegalStateException:没有恢复活动的活动时 [英] Getting a java.lang.IllegalStateException: No activity when resuming an activity

查看:162
本文介绍了获得一个java.lang.IllegalStateException:没有恢复活动的活动时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的活动之一,得到一个奇怪的错误。我想不通为什么会这样。

I'm getting a weird error in one of my activities. I can't figure out why this is happening.

我有一个活动其中显示搜索结果给用户。当他对其中的一个水龙头,对于结果的详细页面显示,当他关闭该活动它返回到搜索结果屏幕。它工作正常,在大多数情况下,除了在它一旦崩溃的活动恢复某些设备。

I have an Activity which displays search results to the user. When he taps on one of them, a detailed page for that result is shown, and when he closes that Activity it goes back to the search result screen. It works fine for the most part, except on certain devices where it crashes as soon as the Activity resumes.

堆栈跟踪也没用,因为它是由支持分段管理器内部抛出。

The stack trace is also useless as it is being thrown internally by the support fragment manager.

03-18 15:32:48.987: E/AndroidRuntime(26456): FATAL EXCEPTION: main
03-18 15:32:48.987: E/AndroidRuntime(26456): java.lang.IllegalStateException: No activity
03-18 15:32:48.987: E/AndroidRuntime(26456):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1075)
03-18 15:32:48.987: E/AndroidRuntime(26456):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1070)
03-18 15:32:48.987: E/AndroidRuntime(26456):    at android.support.v4.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:1871)
03-18 15:32:48.987: E/AndroidRuntime(26456):    at android.support.v4.app.FragmentActivity.onResumeFragments(FragmentActivity.java:455)
03-18 15:32:48.987: E/AndroidRuntime(26456):    at android.support.v4.app.FragmentActivity$1.handleMessage(FragmentActivity.java:91)
03-18 15:32:48.987: E/AndroidRuntime(26456):    at android.os.Handler.dispatchMessage(Handler.java:99)
03-18 15:32:48.987: E/AndroidRuntime(26456):    at android.os.Looper.loop(Looper.java:150)
03-18 15:32:48.987: E/AndroidRuntime(26456):    at android.app.ActivityThread.main(ActivityThread.java:4333)
03-18 15:32:48.987: E/AndroidRuntime(26456):    at java.lang.reflect.Method.invokeNative(Native Method)
03-18 15:32:48.987: E/AndroidRuntime(26456):    at java.lang.reflect.Method.invoke(Method.java:507)
03-18 15:32:48.987: E/AndroidRuntime(26456):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
03-18 15:32:48.987: E/AndroidRuntime(26456):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
03-18 15:32:48.987: E/AndroidRuntime(26456):    at dalvik.system.NativeStart.main(Native Method)
03-18 15:32:48.987: W/ActivityManager(241):   Force finishing activity com.my.app/.SearchActivity

我的活动正在扩大 FragmentActivity ,但只是因为我需要使用 LoaderManager 。移动到标准库是出了问题,因为我的应用程序已经支持Android 2.3。

My Activity is extending FragmentActivity, but only because I need to use the LoaderManager. Moving to the standard library is out of the question since my app has to support Android 2.3.

我曾尝试更新到支持库的新版本,并恢复到一个旧版本,但没有运气。

I have tried updating to the newer version of the support library, and reverting to an older version, but no luck.

我该如何解决这个问题?

How can I fix this?

推荐答案

没关系,我得到了答案 - 这是一样的<一个href=\"http://stackoverflow.com/questions/12784850/application-crashes-on-rotation-without-stacktrace?rq=1\">THIS之一。

Never mind, I got the answer - It's the same as THIS one.

有人曾重写 onWindowFocusChanged(布尔hasFocus)中的详细信息页面,但在叫 super.onResume()而不是。我真希望,该错误信息已经更加清晰,虽然

Someone had overriden onWindowFocusChanged(boolean hasFocus) in the details page but was calling super.onResume() instead. I do wish that the error message had been more clear though.

这篇关于获得一个java.lang.IllegalStateException:没有恢复活动的活动时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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