Code example for SurfaceView

Methods: setVisibility

0
        previewing = true;
    } 
 
    public void hideSurfaceView() { 
        mCamera = null;
        surfaceView.setVisibility(View.INVISIBLE);
        previewing = false;
    } 
 
    public void surfaceCreated(SurfaceHolder holder) {
        // The Surface has been created, acquire the camera and tell it where 
        // to draw. 
        try { 
            if (mCamera != null) {
                mCamera.setPreviewDisplay(holder);
            } 
        } catch (IOException exception) {
            Log.e(TAG, "IOException caused by setPreviewDisplay()", exception);
        } 
    }