Code example for Camera

Methods: cancelAutoFocusstopPreview

0
    } 
 
    public void surfaceDestroyed(SurfaceHolder holder) {
        // Surface will be destroyed when we return, so stop the preview. 
        if (mCamera != null) {
            mCamera.cancelAutoFocus();
            mCamera.stopPreview();
        } 
    } 
 
    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
        if (holder.getSurface() == null){
            // preview surface does not exist 
            return; 
        } 
 
        if (mCamera != null) {
            // Now that the size is known, set up the camera parameters and begin 
            // the preview. 
            Camera.Parameters parameters = mCamera.getParameters();
            parameters.setPreviewSize(previewSize.width, previewSize.height);