Java tutorial
//package com.java2s; import android.hardware.Camera; import android.hardware.Camera.CameraInfo; public class Main { public static int getCameraByDirection(int direction) { int numCameras = Camera.getNumberOfCameras(); CameraInfo info = new CameraInfo(); for (int camid = 0; camid < numCameras; camid++) { Camera.getCameraInfo(camid, info); if (info.facing == direction) { return camid; } } return -1; } }