Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.lang.reflect.Method;

import java.util.List;

import android.hardware.Camera;

public class Main {
    /** Returns a list of available camera preview sizes, or null if the Android API to get the sizes is not available.
     */
    @SuppressWarnings("unchecked")
    public static List<Camera.Size> previewSizesForCameraParameters(Camera.Parameters params) {
        try {
            Method m = params.getClass().getMethod("getSupportedPreviewSizes");
            return (List<Camera.Size>) m.invoke(params);
        } catch (Exception ex) {
            return null;
        }
    }
}