Android examples for Camera:Camera Attribute
get Camera Id
//package com.java2s; import android.hardware.camera2.CameraAccessException; import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CameraManager; public class Main { public static String getCameraId(CameraManager cameraManager, int facing) throws CameraAccessException { for (String cameraId : cameraManager.getCameraIdList()) { CameraCharacteristics characteristics = cameraManager .getCameraCharacteristics(cameraId); if (characteristics.get(CameraCharacteristics.LENS_FACING) == facing) { return cameraId; }/*from w ww . ja v a 2 s .c om*/ } return null; } }