get Camera Large Preview Size - Android Camera

Android examples for Camera:Camera Preview

Description

get Camera Large Preview Size

Demo Code


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

public class Main {
    public static Camera.Size getLargePreviewSize(Camera camera) {
        if (camera != null) {
            List<Camera.Size> sizes = camera.getParameters()
                    .getSupportedPreviewSizes();
            Camera.Size temp = sizes.get(0);
            for (int i = 1; i < sizes.size(); i++) {
                if (temp.width < sizes.get(i).width)
                    temp = sizes.get(i);
            }//w ww.j a v a  2 s .c o m
            return temp;
        }
        return null;
    }
}

Related Tutorials