set Camera Flash Mode - Android Camera

Android examples for Camera:Camera Flash

Description

set Camera Flash Mode

Demo Code


//package com.java2s;
import java.util.List;
import android.hardware.Camera.Parameters;

public class Main {
    public static void setFlashMode(Parameters params, String value) {
        List<String> supported = params.getSupportedFlashModes();
        String supportedValue = getSupportedValue(supported, value);
        if (supportedValue == null) {
            return;
        }//from w  w  w . j av a  2 s  .co m
        params.setFlashMode(supportedValue);
    }

    private static String getSupportedValue(List<String> supported,
            String value) {
        return (supported != null) && supported.contains(value) ? value
                : null;
    }
}

Related Tutorials