Check if Camera size Supported - Android Camera

Android examples for Camera:Camera Size

Description

Check if Camera size Supported

Demo Code


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

public class Main {
    public static boolean sizeSupported(Camera.Parameters cp,
            CamcorderProfile profile) {//w ww  .  jav  a  2 s  .  c om
        List<Camera.Size> sl = cp.getSupportedVideoSizes();

        if (sl == null)
            sl = cp.getSupportedPictureSizes();

        for (Camera.Size s : sl) {
            if (profile.videoFrameWidth == s.width
                    && profile.videoFrameHeight == s.height)
                return true;
        }

        return false;
    }
}

Related Tutorials