Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.hardware.Camera;

import java.util.HashMap;

import java.util.Map;

public class Main {
    /**
     * @return a mapping of all camera ids to matching camera info
     */
    public static Map<Integer, Camera.CameraInfo> getCameras() {
        Map<Integer, Camera.CameraInfo> cameraMap = new HashMap<Integer, Camera.CameraInfo>();

        int numberOfCameras = Camera.getNumberOfCameras();
        Camera.CameraInfo cameraInfo = null;

        for (int i = 0; i < numberOfCameras; i++) {
            cameraInfo = new Camera.CameraInfo();

            Camera.getCameraInfo(i, cameraInfo);

            cameraMap.put(i, cameraInfo);
        }

        return cameraMap;
    }
}