安卓4.4.2 - java.lang.RuntimeException的:活动未恢复执行停止 [英] Android 4.4.2 - java.lang.RuntimeException: Performing stop of activity that is not resumed

查看:838
本文介绍了安卓4.4.2 - java.lang.RuntimeException的:活动未恢复执行停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到这个例外,一个4.4.2设备上。不可再现在Android 4.3设备或更低。

I'm getting this exception on a 4.4.2 device. Not reproducible on Android 4.3 device or lower.

设置为我有一个家庭活动(​​支持子 ActionBarActivity )。家庭活动检查一个布尔标志,如果属实,将启动一个闪​​屏的活动(是的,理想情况下飞溅而来的家庭活动之前,但让我们假设我不能改变其工作方式现在)。

Setup is I have a home activity (subclass of support ActionBarActivity). The home activity checks a boolean flag, and if true, launches a splash screen activity (yes, ideally the splash comes before the home activity, but let's assume I can't change it to work that way for now).

闪屏与 startActivityForResult 推出,它从服务器下载一些配置选项,然后完成并返回结果回到家里的活动。

The splash screen is launched with startActivityForResult, it downloads some config options from the server, then finishes and returns the result back to the home activity.

奇怪的是这个工程罚款4.3及以下,但在4.4设备,我得到了上面的异常(完整的堆栈跟踪):

Weird thing is this works fine on 4.3 and below, but on 4.4 devices, I get the above exception (full stack trace):

02-21 13:36:16.733  24409-24409/test.player E/ActivityThread﹕ Performing stop of activity that is not resumed: {test.player/test.ui.actvities.HomeActivity}
    java.lang.RuntimeException: Performing stop of activity that is not resumed: {test.player/test.ui.actvities.HomeActivity}
            at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3147)
            at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3234)
            at android.app.ActivityThread.access$1100(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1223)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5017)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
            at dalvik.system.NativeStart.main(Native Method)

根据上述情况,它看起来像的onStop(因为我发动对的onCreate飞溅活动)onResume适用于家庭的活动之前调用。

Based on the above, it looks like onStop (because I launch the splash activity on onCreate) is called before onResume for the Home Activity.

这是为什么现在造成4.4.x问题?

Why is this now causing problems in 4.4.x?

推荐答案

这似乎不是我的权利。飞溅的活动现在是在栈上活动,因此 HomeActivity 的onStop生命周期的方法将得到最终调用。巧合的是,我搬到了 startActivity 呼吁飞溅活动从的onCreate onResume HomeActivity 和错误消失。

That doesn't seem right to me. The splash activity would now be the top activity in the stack, so the HomeActivity onStop lifecycle method would get called eventually. Coincidentally, I moved the startActivity call for the splash activity from onCreate to onResume in the HomeActivity, and the error goes away.

这篇关于安卓4.4.2 - java.lang.RuntimeException的:活动未恢复执行停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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