get Large Picture Size - Android android.graphics

Android examples for android.graphics:Picture

Description

get Large Picture Size

Demo Code

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);
            }/*from w  ww .j  a  va  2s .com*/
            return temp;
        }
        return null;
    }

}

Related Tutorials