Reclaim control of camera at runtime?

All your problems with Audio, Video and Images.

Reclaim control of camera at runtime?

Postby underminedsk » Tue Apr 20, 2010 3:31 pm


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>(
W/System.err( 791): at
W/System.err( 791): at com.Alice.utilities.CustomCameraController$3.surfaceCreated(
W/System.err( 791): at android.view.SurfaceView.updateWindow(
W/System.err( 791): at android.view.SurfaceView.dispatchDraw(
W/System.err( 791): at android.view.ViewGroup.drawChild(

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.
Posts: 26
Joined: Tue Mar 02, 2010 3:36 am


Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 5 guests