Hey,
Sometimes, (especially when debugging) I get the following exception when trying to start up the camera:
W/System.err( 791): java.lang.RuntimeException: Fail to connect to camera service
W/System.err( 791): at android.hardware.Camera.native_setup(Native Method)
W/System.err( 791): at android.hardware.Camera.<init>(Camera.java:110)
W/System.err( 791): at android.hardware.Camera.open(Camera.java:90)
W/System.err( 791): at com.Alice.utilities.CustomCameraController$3.surfaceCreated(CustomCameraController.java:90)
W/System.err( 791): at android.view.SurfaceView.updateWindow(SurfaceView.java:454)
W/System.err( 791): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:287)
W/System.err( 791): at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
...
presumably this is because an old instance of my application crashed and didn't properly release the camera. The only solution I've found is to restart my phone (annoying!).
Does anyone know of a way to deal with this at runtime? It would be nice to do something like call Camera.release() and then try again, but the camera API does not support such a static method call.


