Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.util.List;

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

public class Main {

    public static boolean closeFlightLight(Camera camera) {
        if (null != camera) {
            Parameters parameters = camera.getParameters();
            List<String> list = parameters.getSupportedFlashModes();
            for (String string : list) {
                if (Parameters.FLASH_MODE_OFF.equals(string)) {
                    parameters.setFlashMode(string);
                    camera.setParameters(parameters);
                    camera.stopPreview();
                    camera.release();
                    camera = null;
                    return true;
                }
            }
        }
        return false;
    }
}