Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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