views:

27

answers:

1

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)

A: 
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.

CommonsWare
Yes I'm trying to figure out how to pause/stop my thread but all I get is errors.
asd