Java tutorial
//package com.java2s; import android.hardware.Camera; public class Main { private static Camera camera; public static Camera getCameraInstance() throws Exception { if (camera == null) { camera = Camera.open(); // attempt to get a Camera instance } return camera; // returns null if camera is unavailable } }