get Camera Smallest Picture Size - Android Camera

Android examples for Camera:Camera Size

Description

get Camera Smallest Picture Size

Demo Code


//package com.java2s;
import android.hardware.Camera;

public class Main {
    public static Camera.Size getSmallestPictureSize(
            Camera.Parameters parameters) {
        Camera.Size result = null;//from w w w.j a va2 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