Java tutorial
//package com.java2s; //License from project: Apache License import android.hardware.Camera; import android.hardware.Camera.CameraInfo; public class Main { public static final int CAMERA_FACING_FRONT = 1; public static int HasFrontCamera() { int numberOfCameras = Camera.getNumberOfCameras(); CameraInfo cameraInfo = new CameraInfo(); for (int i = 0; i < numberOfCameras; i++) { Camera.getCameraInfo(i, cameraInfo); if (cameraInfo.facing == CAMERA_FACING_FRONT) { return i; } } return 2; } }