Created
July 11, 2018 18:00
-
-
Save amadeu01/68bfee456a5809291c972cec12551fe5 to your computer and use it in GitHub Desktop.
Camera
This file contains 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
CameraManager manager = | |
(CameraManager) view.getContext().getSystemService(CAMERA_SERVICE); | |
try { | |
for (String cameraId : manager.getCameraIdList()) { | |
CameraCharacteristics chars | |
= manager.getCameraCharacteristics(cameraId); | |
App.logException(Log.DEBUG, "PhotoAction", chars.toString()); | |
manager.openCamera(cameraId, new CameraDevice.StateCallback() { | |
@Override | |
public void onOpened(@NonNull CameraDevice camera) { | |
App.logException(Log.DEBUG, "PhotoAction", "onOpened"); | |
} | |
@Override | |
public void onDisconnected(@NonNull CameraDevice camera) { | |
App.logException(Log.DEBUG, "PhotoAction", "onOpened"); | |
} | |
@Override | |
public void onError(@NonNull CameraDevice camera, int error) { | |
App.logException(Log.DEBUG, "PhotoAction", "onError"); | |
camera.close(); | |
} | |
}, new Handler()); | |
} | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment