get Camera Number - Android android.hardware

Android examples for android.hardware:Camera ID

Description

get Camera Number

Demo Code

import android.content.Context;
import android.graphics.Point;
import android.hardware.Camera;
import android.util.Log;
import android.view.Surface;
import android.view.WindowManager;
import java.util.List;

public class Main{

    private static int cameraNumber = -1;
    public static int getCameraNumber() {
        if (cameraNumber == -1) {
            cameraNumber = Camera.getNumberOfCameras();
        }/*  w ww  .  ja  va  2  s. c  o  m*/
        return cameraNumber;
    }

}

Related Tutorials