在Android上使用SurfaceView时的onActivityResult fc

时间:2010-09-04 23:43:53

标签: android surfaceview

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

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

这将是请求的logcat:

09-05 00:17:18.926:ERROR / AndroidRuntime(339):未捕获的处理程序:由于未捕获的异常导致主线程退出 09-05 00:17:18.937:ERROR / AndroidRuntime(339):java.lang.IllegalThreadStateException:线程已经启动。 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):在android.view.SurfaceView.updateWindow(SurfaceView.java:454) 09-05 00:17:18.937:ERROR / AndroidRuntime(339):在android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:189) 09-05 00:17:18.937:ERROR / AndroidRuntime(339):在android.view.View.dispatchWindowVisibilityChanged(View.java:3782) 09-05 00:17:18.937:ERROR / AndroidRuntime(339):在android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692) 09-05 00:17:18.937:ERROR / AndroidRuntime(339):在android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692) 09-05 00:17:18.937:ERROR / AndroidRuntime(339):在android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:692) 09-05 00:17:18.937:ERROR / AndroidRuntime(339):在android.view.ViewRoot.performTraversals(ViewRoot.java:706) 09-05 00:17:18.937:ERROR / AndroidRuntime(339):在android.view.ViewRoot.handleMessage(ViewRoot.java:1633) 09-05 00:17:18.937:ERROR / AndroidRuntime(339):在android.os.Handler.dispatchMessage(Handler.java:99) 09-05 00:17:18.937:ERROR / AndroidRuntime(339):在android.os.Looper.loop(Looper.java:123) 09-05 00:17:18.937:ERROR / AndroidRuntime(339):在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)

1 个答案:

答案 0 :(得分:0)

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)

修复您的代码,使您不启动已启动的线程,此异常将消失。