Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fixed getCameraIds()
private void getCameraIds() {
cameraManager = (CameraManager) appContext.getSystemService(Context.CAMERA_SERVICE);
CameraCharacteristics cameraCharacteristics;
try {
for (String cameraId : cameraManager.getCameraIdList()) {
cameraCharacteristics = cameraManager.getCameraCharacteristics(cameraId);
if (isCameraFacingBack(cameraCharacteristics) && backCameraId == null) {
backCameraId = cameraId;
} else if (isCameraFacingFront(cameraCharacteristics) && frontCameraId == null) {
frontCameraId = cameraId;
}
}
} catch (CameraAccessException exception) {
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment