Last active
February 12, 2020 01:06
-
-
Save JosiasSena/cb50b53114621b55529130a3a303ccd9 to your computer and use it in GitHub Desktop.
Buggy getCameraIds()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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