Here you can find the source of getFirstBackFacingCameraID()
public static int getFirstBackFacingCameraID()
//package com.java2s; import android.hardware.Camera; public class Main { /**/*from ww w. j a va2s . c om*/ * * @return the id of the first BackFacing camera */ public static int getFirstBackFacingCameraID() { int lCamId = 0; for (lCamId = 0; lCamId < Camera.getNumberOfCameras(); lCamId++) { Camera.CameraInfo lCameraInfo = new Camera.CameraInfo(); Camera.getCameraInfo(lCamId, lCameraInfo); if (lCameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK) return lCamId; } return 0; } }