Showing posts with label andorid application flashlight. Show all posts
Showing posts with label andorid application flashlight. Show all posts

Monday, August 12, 2013

Flashlight Android Application

Hi guys, today I wanna tell about one of my experince on android app development. A couple of days ago, I wrote a Flashlight android app using docs in developer.android.com, I checked the app in two different phones:

  • first in a Motorola phone: my app worked perfect, it did its job. (turning on and turning off flash of the camera)
  • second in a Samsung SIII Mini: my app didn't work, it didn't do its job. (when I touched the 'open flash' button, flash couldn't open.)

So, I started to search the problem. There were a lot of statements in websites like that: "FLASH_MODE_TORCH doesn't work on samsung". I have used this parameter in my app too. I didn't believe that, because when I request possible parameters from eclipse by pressing Cntrl+Enter there was only one parameter which can open the flash: FLASH_MODE_TORCH. So, I thought there must be a missing code which requires in samsung phones and not needs in phones like Motorola. I continued to search and found a nice solution which says use "camera.startPreview()" after setting parameters of the camera. I used this in my app and it worked in samsung phones too.

The picture of my app are given in the following, and you can download it from the link below pic. I wrote the app just for an example, so its gui is really bad and simple.



If you like this article, use the share buttons below to help my blog.
If you have any question or need some help, leave a comment below.

Read More