Android Camera Get getCameraId(int facing)

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

Description

get Camera Id

Declaration

public static int getCameraId(int facing) 

Method Source Code

//package com.java2s;

import android.hardware.Camera;
import android.hardware.Camera.CameraInfo;

public class Main {
    public static int getCameraId(int facing) {
        int cameraId = -1;
        // Search for the front facing camera
        int numberOfCameras = Camera.getNumberOfCameras();
        for (int i = 0; i < numberOfCameras; i++) {
            CameraInfo info = new CameraInfo();
            Camera.getCameraInfo(i, info);
            if (info.facing == facing) {
                cameraId = i;/*from   w  w  w.j a va  2s.c  om*/
                break;
            }
        }
        return cameraId;
    }
}

Related

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