Code example for SurfaceTexture

0
        else 
        	mCamera.setPreviewDisplay(null);
	} 
     
    public boolean openCamera() { 
        Log.i(TAG, "openCamera");
        releaseCamera(); 
        mCamera = Camera.open();
        if(mCamera == null) {
        	Log.e(TAG, "Can't open camera!");
        	return false; 
        } 
 
        mCamera.setPreviewCallbackWithBuffer(new PreviewCallback() {
            public void onPreviewFrame(byte[] data, Camera camera) {
                synchronized (SampleViewBase.this) {
                    System.arraycopy(data, 0, mFrame, 0, data.length);
                    SampleViewBase.this.notify(); 
                } 
                camera.addCallbackBuffer(mBuffer);
            }