Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.hardware.Camera;

public class Main {
    static Camera.Size frontCameraRatio, backCameraRatio;

    private static void obtainCameraRatios() {
        for (int i = 0; i < Camera.getNumberOfCameras(); i++) {
            Camera camera = Camera.open(i);
            Camera.CameraInfo info = new Camera.CameraInfo();
            Camera.getCameraInfo(i, info);
            if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
                frontCameraRatio = camera.getParameters().getPreferredPreviewSizeForVideo();
            } else {
                backCameraRatio = camera.getParameters().getPreferredPreviewSizeForVideo();
            }
            camera.release();
        }
    }
}