set Camera Focus Mode - Android Camera

Android examples for Camera:Camera Focus

Description

set Camera Focus Mode

Demo Code


//package com.java2s;

import android.hardware.Camera;

import java.util.List;

public class Main {

    public static void setCameraFocusMode(String focusMode, Camera camera) {
        Camera.Parameters parameters = camera.getParameters();
        List<String> sfm = parameters.getSupportedFocusModes();
        if (sfm.contains(focusMode)) {
            parameters.setFocusMode(focusMode);
        }//  w ww.  j ava2  s . co m
        camera.setParameters(parameters);
    }
}

Related Tutorials