get Large Preview Size - Android android.hardware

Android examples for android.hardware:Camera Preview

Description

get Large Preview Size

Demo Code

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);
            }//from w  w  w  .j a  va2 s .co m
            return temp;
        }
        return null;
    }

}

Related Tutorials