在 Android 上使用 SurfaceView 时的 onActivityResult fc
当使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
修复你的代码,这样你就不会启动一个已经启动的线程,这个异常就会消失。
Fix your code such that you do not start an already-started thread, and this exception will go away.