Flashlight App Android Example

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.

Also Read: Simple Notepad App Android Example
Also Read: How to Make a Calculator App for Android


Flashlight App Android Example


Flashlight App Android Example

Create a new project with package name com.thecrazyprogrammer.www.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.


Camera Permission

Make sure to add following two lines in AndroidManifest.xml file to get access to camera device.


You can test this app in your mobile by downloading the apk from below link.

– Download Flashlight Apk –


If you found anything incorrect or have doubts regarding above flashlight app android example tutorial then comment below.

11 thoughts on “Flashlight App Android Example”

  1. Bro can u tell me in brief about this??
    I m a beginner anddon’t know about which app or software to use for this type of coding.
    And also I didn’t understand this coding
    I don’t know much of the things
    Can u help??

  2. Hello Crazy Programmer!
    I’m working on and android app mixing android and openframeworks and i need to use android 21 and this .camera is depreciate know you have to use .camera2 that already contain a function for torch light and you don’t need to open the camera anymore. I haven’t find any tutorial or good reference to do this did you already use it or you have a tutorial i will appreciate any help. Thanks.

      1. sir i think that the marshmallow runtime permisson is needed in api 23 6.0+ which is not added plz add this permissons thanks

  3. hy!
    can u plz tell me on which platform i can run this code?? so that i don’t have to download it.
    as i do coding in java on bluej!!

  4. ubaid mohamed dahir

    I tried this code and it is not displays an error but when i used it to compile my phone it says “flash has stopped”

Leave a Comment

Your email address will not be published. Required fields are marked *