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();