After stop camera service, the camera does not work anymore
Is there any way to correctly stop the camera service? This do开发者_如何学JAVAes 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.
public void surfaceDestroyed(SurfaceHolder holder) {
camera.stopPreview();
camera.release();
camera=null;
}
This works fine for me. Make sure your surfaceDestroyed()
method is getting invoked.
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
精彩评论