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.

MainActivity.java

 

activity_main.xml

 

AndroidManifest.xml

 

Explanation

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.

3 thoughts on “Flashlight App Android Example

  1. Kadam parikh

    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??
    Plzz

    Reply
  2. tomb

    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.

    Reply

Leave a Reply

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