Android examples for android.hardware:Back Camera
get Camera facing Back Id
import android.hardware.Camera; import android.hardware.Camera.CameraInfo; public class Main { static public int getBackId() throws Exception { int numberOfCameras = Camera.getNumberOfCameras(); CameraInfo cameraInfo = new CameraInfo(); for (int i = 0; i < numberOfCameras; i++) { Camera.getCameraInfo(i, cameraInfo); if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) { return i; }// w w w . ja v a 2 s.c om } throw new Exception(); } }