@TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH)
 public static boolean isFocusAreaSupported(Parameters params) {
   if (ApiHelper.HAS_CAMERA_FOCUS_AREA) {
     return (params.getMaxNumFocusAreas() > 0
         && isSupported(Parameters.FOCUS_MODE_AUTO, params.getSupportedFocusModes()));
   }
   return false;
 }
  private void showFlashButton(Parameters params) {
    boolean showFlash =
        (getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH)
                && params.getFlashMode() != null)
            && params.getSupportedFlashModes() != null
            && params.getSupportedFocusModes().size() > 1;

    flashCameraButton.setVisibility(showFlash ? View.VISIBLE : View.INVISIBLE);
  }
  public void setAutoFocus() {
    Parameters params = cam.getParameters();
    List<String> focusModes = params.getSupportedFocusModes();
    try {
      if (focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) {
        params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);

      } else if (focusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO)) {
        params.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);

      } else if (focusModes.contains(Camera.Parameters.FOCUS_MODE_INFINITY)) {
        params.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY);
      }
    } catch (Exception ex) {

    }
  }