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 android.hardware.Camera;

public class Main {
    /** Returns true if the device's API and camera supports zooming. */
    public static boolean cameraSupportsZoom(Camera camera) {
        if (!sdkSupportsCameraZoom())
            return false;
        try {
            Camera.Parameters params = camera.getParameters();
            Method zoomSupported = params.getClass().getMethod("isZoomSupported");
            return (Boolean) zoomSupported.invoke(params);
        } catch (Exception ex) {
            return false;
        }
    }

    static boolean sdkSupportsCameraZoom() {
        return (android.os.Build.VERSION.SDK_INT >= 8);
    }
}