Skip to content

Instantly share code, notes, and snippets.

@ssaurel
Created October 19, 2017 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssaurel/2f709bbabca32e718606643ef2a90aac to your computer and use it in GitHub Desktop.
Save ssaurel/2f709bbabca32e718606643ef2a90aac to your computer and use it in GitHub Desktop.
Flash Light Off Method on the SSaurel's Blog
private void flashLightOff() {
CameraManager cameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
try {
String cameraId = cameraManager.getCameraIdList()[0];
cameraManager.setTorchMode(cameraId, false);
flashLightStatus = false;
imageFlashlight.setImageResource(R.drawable.btn_switch_off);
} catch (CameraAccessException e) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment