@@ -0,0 +1,2266 @@
+package your.package;%0A%0Aimport android.content.Context;%0Aimport android.hardware.Camera;%0Aimport android.util.Log;%0Aimport android.view.SurfaceHolder;%0Aimport android.view.SurfaceView;%0Aimport java.io.IOException;%0A%0Apublic class CameraView extends SurfaceView implements SurfaceHolder.Callback%7B%0A    private SurfaceHolder mHolder;%0A    private Camera mCamera;%0A    private String TAG = %22Application%22;%0A%0A    public CameraView(Context context, Camera camera)%7B%0A        super(context);%0A        mCamera = camera;%0A%0A        // Install a SurfaceHolder.Callback so we get notified when the%0A        // underlying surface is created and destroyed.%0A        mHolder = getHolder();%0A        mHolder.addCallback(this);%0A        // deprecated setting, but required on Android versions prior to 3.0%0A        mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);%0A    %7D%0A%0A    public void surfaceCreated(SurfaceHolder holder)%7B%0A        // The Surface has been created, now tell the camera where to draw the preview.%0A        try %7B%0A            mCamera.setPreviewDisplay(holder);%0A            mCamera.startPreview();%0A        %7D catch (IOException e) %7B%0A            Log.d(TAG, %22Error setting camera preview: %22 + e.getMessage());%0A        %7D%0A    %7D%0A%0A    public void surfaceDestroyed(SurfaceHolder holder)%7B%0A        // empty. Take care of releasing the Camera preview in your activity.%0A    %7D%0A%0A    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h)%7B%0A        // If your preview can change or rotate, take care of those events here.%0A        // Make sure to stop the preview before resizing or reformatting it.%0A%0A        if (mHolder.getSurface() == null)%7B%0A            // preview surface does not exist%0A            return;%0A        %7D%0A%0A        // stop preview before making changes%0A        try%7B%0A            mCamera.stopPreview();%0A        %7D catch (Exception e)%7B%0A            // ignore: tried to stop a non-existent preview%0A        %7D%0A%0A        // set preview size and make any resize, rotate or%0A        // reformatting changes here%0A%0A        // start preview with new settings%0A        try%7B%0A            mCamera.setPreviewDisplay(mHolder);%0A            mCamera.startPreview();%0A%0A        %7D catch (Exception e)%7B%0A            Log.d(TAG, %22Error starting camera preview: %22 + e.getMessage());%0A        %7D%0A    %7D%0A%7D%0A

Create CameraView.java