Turn off flash - Android Camera

Android examples for Camera:Camera Flash

Description

Turn off flash

Demo Code


//package com.java2s;

import android.hardware.Camera;
import android.hardware.Camera.Parameters;

public class Main {
    public static Camera camera;
    public static boolean isFlashOn;
    public static Parameters params;

    /**//from   ww  w .  j  a v  a  2 s .  c o  m
     * Turn off flash
     */
    public static void turnOffFlash() {
        if (isFlashOn) {
            if (camera == null || params == null) {
                return;
            }
            params.setFlashMode(Parameters.FLASH_MODE_OFF);
            camera.setParameters(params);
            isFlashOn = false;
        }
    }
}

Related Tutorials