Last active
October 19, 2017 12:33
-
-
Save ssaurel/3889b458e2db275cc93d9bf2bf1e702d to your computer and use it in GitHub Desktop.
Manage Flashlight on the SSaurel's Blog
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
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