In this tutorial I will teach you to make a very basic and simple flashlight app for android. This application lets you turn on and off your phone camera’s LED flash. I have tested this app in some Micromax and Karbonn mobiles.
Flashlight App Android Example
Create a new project with package name in.co.makeiton.flashlight. You can change it according to you, but make sure to change the package name in the main code.
Turn On Flashlight
The following code turn on the flashlight.
Camera is a class used to perform all functionality related to camera.
Turn Off Flashlight
The following code turn off the flashlight.
Make sure to add following two lines in AndroidManifest.xml file to get access to camera device.