在 Android 上使用 SurfaceView 时的 onActivityResult fc

发布于 2024-09-17 21:34:38 字数 2265 浏览 5 评论 0原文

当使用 SurfaceView 作为内容视图的活动调用 startActivityForResult(...) 并且已启动的活动调用 finish() 时,我的应用程序 fc

如果我将内容视图更改为 SurfaceView 以外的其他内容,则不会发生这种情况。

这将是请求的 logcat:

09-05 00:17:18.926: ERROR/AndroidRuntime(339): Uncaught handler: thread main exiting due to uncaught exception 09-05 00:17:18.937:错误/AndroidRuntime(339):java.lang.IllegalThreadStateException:线程已启动。 09-05 00:17:18.937:错误/AndroidRuntime(339):在java.lang.Thread.start(Thread.java:1322) 09-05 00:17:18.937:错误/AndroidRuntime(339):在 fi.mikuz.soundboards.GraphicalSoundboardEditor$DrawingPanel.surfaceCreated(GraphicalSoundboardEditor.java:426) 09-05 00:17:18.937:错误/AndroidRuntime(339):在android.view.SurfaceView.updateWindow(SurfaceView.java:454) 09-05 00:17:18.937:错误/AndroidRuntime(339):在android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:189) 09-05 00:17:18.937:错误/AndroidRuntime(339):在android.view.View.dispatchWindowVisibilityChanged(View.java:3782) 09-05 00:17:18.937:错误/AndroidRuntime(339):在android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692) 09-05 00:17:18.937:错误/AndroidRuntime(339):在android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692) 09-05 00:17:18.937:错误/AndroidRuntime(339):在android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692) 09-05 00:17:18.937:错误/AndroidRuntime(339):在android.view.ViewRoot.performTraversals(ViewRoot.java:706) 09-05 00:17:18.937:错误/AndroidRuntime(339):在android.view.ViewRoot.handleMessage(ViewRoot.java:1633) 09-05 00:17:18.937:错误/AndroidRuntime(339):在android.os.Handler.dispatchMessage(Handler.java:99) 09-05 00:17:18.937:错误/AndroidRuntime(339):在android.os.Looper.loop(Looper.java:123) 09-05 00:17:18.937:错误/AndroidRuntime(339):在android.app.ActivityThread.main(ActivityThread.java:4363) 09-05 00:17:18.937:错误/AndroidRuntime(339):在java.lang.reflect.Method.invokeNative(本机方法) 09-05 00:17:18.937:错误/AndroidRuntime(339):在java.lang.reflect.Method.invoke(Method.java:521) 09-05 00:17:18.937: 错误/AndroidRuntime(339): 在 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 09-05 00:17:18.937:错误/AndroidRuntime(339):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 09-05 00:17:18.937:错误/AndroidRuntime(339):在dalvik.system.NativeStart.main(本机方法)

My app fc when activity that's using SurfaceView as content view calls startActivityForResult(...) and activity that has been started calls finish()

This does not happen if I change content view to something else than SurfaceView.

This would be the requested logcat:

09-05 00:17:18.926: ERROR/AndroidRuntime(339): Uncaught handler: thread main exiting due to uncaught exception
09-05 00:17:18.937: ERROR/AndroidRuntime(339): java.lang.IllegalThreadStateException: Thread already started.
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at java.lang.Thread.start(Thread.java:1322)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at fi.mikuz.soundboards.GraphicalSoundboardEditor$DrawingPanel.surfaceCreated(GraphicalSoundboardEditor.java:426)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at android.view.SurfaceView.updateWindow(SurfaceView.java:454)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:189)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at android.view.View.dispatchWindowVisibilityChanged(View.java:3782)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at android.view.ViewRoot.performTraversals(ViewRoot.java:706)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at android.os.Handler.dispatchMessage(Handler.java:99)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at android.os.Looper.loop(Looper.java:123)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at android.app.ActivityThread.main(ActivityThread.java:4363)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at java.lang.reflect.Method.invokeNative(Native Method)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at java.lang.reflect.Method.invoke(Method.java:521)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at dalvik.system.NativeStart.main(Native Method)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心是晴朗的。 2024-09-24 21:34:38
09-05 00:17:18.926: ERROR/AndroidRuntime(339): Uncaught handler: thread main exiting due to uncaught exception
09-05 00:17:18.937: ERROR/AndroidRuntime(339): java.lang.IllegalThreadStateException: Thread already started.
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at java.lang.Thread.start(Thread.java:1322)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at fi.mikuz.soundboards.GraphicalSoundboardEditor$DrawingPanel.surfaceCreated(GraphicalSoundboardEditor.java:426)

修复你的代码,这样你就不会启动一个已经启动的线程,这个异常就会消失。

09-05 00:17:18.926: ERROR/AndroidRuntime(339): Uncaught handler: thread main exiting due to uncaught exception
09-05 00:17:18.937: ERROR/AndroidRuntime(339): java.lang.IllegalThreadStateException: Thread already started.
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at java.lang.Thread.start(Thread.java:1322)
09-05 00:17:18.937: ERROR/AndroidRuntime(339): at fi.mikuz.soundboards.GraphicalSoundboardEditor$DrawingPanel.surfaceCreated(GraphicalSoundboardEditor.java:426)

Fix your code such that you do not start an already-started thread, and this exception will go away.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文