get Back Camera Number - Android Camera

Android examples for Camera:Back Camera

Description

get Back Camera Number

Demo Code


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

public class Main {
    public static int getBackCameraNumber() {
        for (int i = 0; i < Camera.getNumberOfCameras(); i++) {
            Camera.CameraInfo info = new Camera.CameraInfo();
            Camera.getCameraInfo(i, info);
            if (info.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
                return i;
            }/*from   w w w  . ja v  a 2 s . c  o m*/
        }
        return 0;
    }
}

Related Tutorials