Android Camera Get getDefaultCamera(int position)

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

Description

get Default Camera

Declaration

public static Camera getDefaultCamera(int position) 

Method Source Code

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

public class Main {
    public static Camera getDefaultCamera(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 Camera.open(i);
            }//from   www . ja  v a  2s .c  o  m
        }

        return null;
    }
}

Related

  1. getCameraId(int position)
  2. getCameraInstance()
  3. getCameraInstance()
  4. getCameraInstance()
  5. getDefaultCamera(int position)
  6. getDefaultCameraInstance()
  7. getDefaultFrontFacingCameraInstance()
  8. getNumberOfCameras()
  9. getDefaultBackFacingCameraInstance()