Android examples for Camera:Camera Facing
Get Camera Id by facing
//package com.java2s; import android.hardware.Camera; import android.hardware.Camera.CameraInfo; public class Main { private static int firstArgFacingCameraId(final int cameraFacing) { final int numberOfCameras = Camera.getNumberOfCameras(); int cameraId = 0; for (int i = 0; i < numberOfCameras; i++) { final CameraInfo info = new CameraInfo(); Camera.getCameraInfo(i, info); if (info.facing == cameraFacing) { return i; }//from w w w. j a v a 2 s . c om } return cameraId; } }