get Camera Smallest Picture Size - Android android.hardware

Android examples for android.hardware:Camera Size

Description

get Camera Smallest Picture Size

Demo Code

import android.hardware.Camera;

public class Main {

  public static Camera.Size getSmallestPictureSize(Camera.Parameters parameters) {
    Camera.Size result = null;/* w w w . j  a v a2 s . c  o  m*/

    for (Camera.Size size : parameters.getSupportedPictureSizes()) {
      if (result == null) {
        result = size;
      } else {
        int resultArea = result.width * result.height;
        int newArea = size.width * size.height;

        if (newArea < resultArea) {
          result = size;
        }
      }
    }

    return (result);
  }

}

Related Tutorials