Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Buggy 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 = cameraId;
} else if (isCameraFacingFront(cameraCharacteristics)) {
frontCameraId = cameraId;
}
}
} catch (CameraAccessException exception) {
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment