Skip to content

Instantly share code, notes, and snippets.

@ssaurel
Last active October 19, 2017 12:33
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/3889b458e2db275cc93d9bf2bf1e702d to your computer and use it in GitHub Desktop.
Save ssaurel/3889b458e2db275cc93d9bf2bf1e702d to your computer and use it in GitHub Desktop.
Manage Flashlight on the SSaurel's Blog
imageFlashlight.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (hasCameraFlash) {
if (flashLightStatus)
flashLightOff();
else
flashLightOn();
} else {
Toast.makeText(MainActivity.this, "No flash available on your device",
Toast.LENGTH_SHORT).show();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment