is Auto Focus Continuous Picture Supported - Android android.graphics

Android examples for android.graphics:Picture

Description

is Auto Focus Continuous Picture Supported

Demo Code

import java.util.List;

import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.Camera;

public class Main {

  /**/*from  w  w w  . j a va  2s . c o  m*/
   * Is the camera auto focus feature supported?
   * 
   * @param params
   *          Camera parameters
   * @param context
   *          Application context
   * @return Is the camera auto focus feature supported?
   */
  public static boolean isAutoFocusContinuousPictureSupported(Camera.Parameters params, Context context) {
    boolean isAutoFocusContinuousPictureSupported = false;
    if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_AUTOFOCUS)) {
      isAutoFocusContinuousPictureSupported = isCameraFeatureSupported(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE,
          params.getSupportedFocusModes());
    }

    return isAutoFocusContinuousPictureSupported;
  }

  /**
   * @param value
   * @param supported
   *          A list of supporte camera features
   * @return Is the vamera feature supported?
   */
  private static boolean isCameraFeatureSupported(String value, List<String> supported) {
    return supported == null ? false : supported.contains(value);
  }

}

Related Tutorials