tags:

views:

80

answers:

2

Is there any way to correctly stop the camera service? This does not seem to work:

public void surfaceDestroyed(SurfaceHolder holder){
    camera.stopPreview();
    camera = null;
}

After doing that the camera does not work, even if I use the program that is preinstalled in my handset.

A: 
public void surfaceDestroyed(SurfaceHolder holder) {
    camera.stopPreview();
    camera.release();
    camera=null;
}

This works fine for me. Make sure your surfaceDestroyed() method is getting invoked.

CommonsWare
+1  A: 

If you are using the the preview callback you might want to deregister it in your surfaceDestroyed

mCamera.setPreviewCallback(null);

mCamera is supposed to be your Camera object

ee3509