Java tutorial
//package com.java2s; import android.hardware.Camera; import android.hardware.Camera.CameraInfo; public class Main { public static int cameraId = -1; /** * @return front camera */ public static Camera getFrontCamera() { CameraInfo cameraInfo = new CameraInfo(); int cameraCount = Camera.getNumberOfCameras(); for (int i = 0; i < cameraCount; i++) { Camera.getCameraInfo(i, cameraInfo); if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { cameraId = i; return Camera.open(i); } } return null; } }