Returns a list of available camera picture sizes, or null if the Android API to get the sizes is not available. - Android Camera

Android examples for Camera:Camera Size

Description

Returns a list of available camera picture sizes, or null if the Android API to get the sizes is not available.

Demo Code


//package com.java2s;
import java.lang.reflect.Method;

import java.util.List;

import android.hardware.Camera;

public class Main {
    /** Returns a list of available camera picture sizes, or null if the Android API to get the sizes is not available.
     *///www.  j a v a  2s.co m
    public static List<Camera.Size> pictureSizesForCameraParameters(
            Camera.Parameters params) {
        try {
            Method m = params.getClass().getMethod(
                    "getSupportedPictureSizes");
            return (List<Camera.Size>) m.invoke(params);
        } catch (Exception ex) {
            return null;
        }
    }
}

Related Tutorials