Search code examples
androidflashlightmotorola-droid

Flashlight Only turns On for less than a second


I'm using the following code but the flashlight would just on for less then a second when i press the button.

I'm Using Motorola XT907

Camera  cam;
cam = Camera.open();
Camera.Parameters p = cam.getParameters();
p.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
cam.setParameters(p);
cam.startPreview();

Solution

  • SOLVED

    Somehow using the SurfaceView and SurfaceHolder class solved the problem for me

    Code is described in the following thread.

    LED flashlight on Galaxy Nexus controllable by what API?