Android examples for android.hardware:Camera
take Picture via android.hardware.Camera
import android.hardware.Camera; import android.hardware.Camera.CameraInfo; public class Main { public static void takePicture() { Camera camera;/*from w ww .j a v a2s .c om*/ int cameraId = -1; int numberOfCameras = Camera.getNumberOfCameras(); for (int i = 0; i < numberOfCameras; i++) { CameraInfo info = new CameraInfo(); Camera.getCameraInfo(i, info); if (info.facing == CameraInfo.CAMERA_FACING_BACK) { cameraId = i; break; } } if (cameraId >= 0) { camera = Camera.open(cameraId); camera.release(); } } }