Search code examples
androidflashcameraandroid-1.5-cupcake

set flash mode camera.parameters android 1.5


I'm trying to use the camera in an Android app using the 1.5 API. I want the camera to flash for every picture. However, when I looked at the API for camera.parameters, the setFlashMode() method is only supported for 2.0 and higher. Yet my Cliq XT, which runs 1.5, has a flash that I can set in the menu - I take this to mean there is a way to do this for the 1.5 API, though I was unable to find it.

Does anyone know how to set the flash mode using the 1.5 API?


Solution

  • You can use the following code to set the flash in older versions of the API:

    Parameters params = camera.getParameters();
    params.set("flash-mode", "on");
    camera.setParameters(params);
    

    I just guessed on the values to send to the .set method, but I just tested it and this turns on the flash.