gpt4 book ai didi

Android 4.4.2 - java.lang.RuntimeException : Performing stop of activity that is not resumed

转载 作者:IT王子 更新时间:2023-10-29 00:09:37 25 4
gpt4 key购买 nike

我在 4.4.2 设备上遇到此异常。无法在 Android 4.3 或更低版本的设备上重现。

设置是我有一个家庭 Activity (支持ActionBarActivity的子类)。 home Activity 检查一个 bool 标志,如果为 true,则启动一个启动屏幕 Activity(是的,理想情况下,启动在 home Activity 之前,但假设我现在不能将其更改为以这种方式工作)。

启动画面使用 startActivityForResult 启动,它从服务器下载一些配置选项,然后完成并将结果返回给主 Activity。

奇怪的是这在 4.3 及更低版本上运行良好,但在 4.4 设备上,我得到了上述异常(完整堆栈跟踪):

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 上启动了启动 Activity )在 Home Activity 的 onResume 之前被调用。

为什么现在这会导致 4.4.x 出现问题?

最佳答案

这对我来说似乎不对。现在,启动 Activity 将成为堆栈中的顶部 Activity ,因此 HomeActivity onStop 生命周期方法最终将被调用。巧合的是,我将启动 Activity 的 startActivity 调用从 onCreate 移动到 HomeActivity 中的 onResume,并且错误消失了。

关于Android 4.4.2 - java.lang.RuntimeException : Performing stop of activity that is not resumed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21947675/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com