get Camera Supported Video Sizes by SDK version - Android Camera

Android examples for Camera:Camera Size

Description

get Camera Supported Video Sizes by SDK version

Demo Code


//package com.java2s;
import java.util.List;
import android.annotation.SuppressLint;

import android.hardware.Camera.Size;
import android.os.Build;

public class Main {
    @SuppressLint("NewApi")
    public static List<Size> getCameraSupportedVideoSizes(
            android.hardware.Camera camera) {

        List sizes;/*from w w w .java2  s  .  c  o m*/

        if ((Build.VERSION.SDK_INT >= 11) && (camera != null)) {
            if (camera.getParameters().getSupportedVideoSizes() != null) {
                sizes = camera.getParameters().getSupportedVideoSizes();
            } else {
                // Video sizes may be null, which indicates that all the supported 
                // preview sizes are supported for video recording.
                sizes = camera.getParameters().getSupportedPreviewSizes();
            }
            return sizes;
        } else {
            return null;
        }
    }
}

Related Tutorials