get Camera Large Picture Size - Android Camera

Android examples for Camera:Camera Size

Description

get Camera Large Picture Size

Demo Code


//package com.java2s;
import android.hardware.Camera;
import java.util.List;

public class Main {
    public static Camera.Size getLargePictureSize(Camera camera) {
        if (camera != null) {
            List<Camera.Size> sizes = camera.getParameters()
                    .getSupportedPictureSizes();
            Camera.Size temp = sizes.get(0);
            for (int i = 1; i < sizes.size(); i++) {
                float scale = (float) (sizes.get(i).height)
                        / sizes.get(i).width;
                if (temp.width < sizes.get(i).width && scale < 0.6f
                        && scale > 0.5f)
                    temp = sizes.get(i);
            }//ww w . j a  v  a2s.c  om
            return temp;
        }
        return null;
    }
}

Related Tutorials