Android examples for android.hardware:Camera ID
get Camera Id
import android.annotation.TargetApi; import android.hardware.Camera; import android.os.Build; public class Main { @TargetApi(Build.VERSION_CODES.GINGERBREAD) private static int getCameraId(int facing) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { Camera.CameraInfo info = new Camera.CameraInfo(); for (int i = 0; i < Camera.getNumberOfCameras(); i++) { Camera.getCameraInfo(i, info);//from www. ja v a2s.c o m if (info.facing == facing) { return i; } } } return 0; } }