Android Camera Get getCameraId(int position)

Here you can find the source of getCameraId(int position)

Description

get Camera Id

Declaration

public static int getCameraId(int position) 

Method Source Code

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

public class Main {
    public static int getCameraId(int position) {
        // Find the total number of cameras available
        int mNumberOfCameras = Camera.getNumberOfCameras();

        // Find the ID of the back-facing ("default") camera
        Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
        for (int i = 0; i < mNumberOfCameras; i++) {
            Camera.getCameraInfo(i, cameraInfo);
            if (cameraInfo.facing == position)
                return i;
        }//w  w  w.  j  a va  2  s. c  om

        return 0;
    }
}

Related

  1. getCamera()
  2. getCameraId()
  3. getCameraId(int facing)
  4. getCameraInstance()
  5. getCameraInstance()
  6. getCameraInstance()
  7. getDefaultCamera(int position)