开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜