Android Utililty Methods Camera Get

List of utility methods to do Camera Get

Description

The list of methods to do Camera Get are organized into topic(s).

Method

CameragetCamera()
get Camera
return mCamera;
intgetCameraId()
get Camera Id
return mCameraId;
intgetCameraId(int facing)
get Camera Id
int cameraId = -1;
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;
        break;
...
intgetCameraId(int position)
get Camera Id
int mNumberOfCameras = Camera.getNumberOfCameras();
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
for (int i = 0; i < mNumberOfCameras; i++) {
    Camera.getCameraInfo(i, cameraInfo);
    if (cameraInfo.facing == position)
        return i;
return 0;
...
CameragetCameraInstance()
get Camera Instance
Camera c = null;
try {
    c = Camera.open(); 
} catch (Exception e) {
return c; 
CameragetCameraInstance()
get Camera Instance
Camera c = null;
try {
    c = Camera.open(); 
} catch (Exception e) {
return c; 
CameragetCameraInstance()
get Camera Instance
Camera c = null;
try {
    c = Camera.open(Camera.CameraInfo.CAMERA_FACING_FRONT); 
} catch (Exception e) {
return c; 
CameragetDefaultCamera(int position)
get Default Camera
int mNumberOfCameras = Camera.getNumberOfCameras();
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);
return null;
CameragetDefaultCamera(int position)
get Default Camera
int mNumberOfCameras = Camera.getNumberOfCameras();
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);
return null;
CameragetDefaultCameraInstance()
get Default Camera Instance
return Camera.open();