Returns a list of available camera picture sizes - Android android.hardware

Android examples for android.hardware:Camera Size

Description

Returns a list of available camera picture sizes

Demo Code

import android.graphics.Bitmap;
import android.hardware.Camera;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;

public class Main{

    /** Returns a list of available camera picture sizes, or null if the Android API to get the sizes is not available.
     *///from   w  ww  .jav a  2 s . c o  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