Code example for SurfaceTexture

0
        return mFrameHeight;
    } 
 
    public void setPreview() throws IOException { 
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
            mCamera.setPreviewTexture( new SurfaceTexture(10) );
        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) {