@@ -0,0 +1,1358 @@
+%0Aimport android.hardware.Camera;%0Aimport android.app.Activity;%0Aimport android.content.Context;%0A%0Apublic class MainActivity extends Activity  implements SensorEventListener %7B%0A    private Camera mCamera;%0A    private CameraView cameraView;%0A    %0A    @Override%0A    protected void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        setContentView(R.layout.activity_main);%0A    %7D%0A    %0A    protected void onResume()%7B%0A        super.onResume();%0A        mCamera = getCameraInstance();%0A        mCamera.setDisplayOrientation(90);%0A        cameraView = new CameraView(this, mCamera);%0A        mainView.addView(cameraView);%0A        mainView.bringChildToFront(buttonView);%0A        senSensorManager.registerListener(this, senRotation, SensorManager.SENSOR_DELAY_GAME);%0A    %7D%0A%0A    /** A safe way to get an instance of the Camera object. */%0A    public Camera getCameraInstance()%7B%0A        Camera c = null;%0A        try%7B%0A            c = Camera.open(); // attempt to get a Camera instance%0A            Camera.Parameters parameters = c.getParameters();%0A            parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);%0A            c.setParameters(parameters);%0A        %7D%0A        catch (Exception e)%7B%0A            // Camera is not available (in use or does not exist)%0A        %7D%0A%0A        return c; // returns null if camera is unavailable%0A    %7D%0A%7D%0A

Create MainActivity.java