Android examples for Camera:Camera Focus
Is the camera auto focus feature supported?
//package com.java2s; import android.content.Context; import android.content.pm.PackageManager; import android.hardware.Camera; import java.util.List; public class Main { public static boolean isAutoFocusContinousPictureSupported( Camera.Parameters params, Context context) { boolean isAutoFocusContinousPictureSupported = false; if (context.getPackageManager().hasSystemFeature( PackageManager.FEATURE_CAMERA_AUTOFOCUS)) { isAutoFocusContinousPictureSupported = isCameraFeatureSupported( Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE, params.getSupportedFocusModes()); }/* w w w .j a va2 s. co m*/ return isAutoFocusContinousPictureSupported; } private static boolean isCameraFeatureSupported(String value, List<String> supported) { return supported == null ? false : supported.contains(value); } }