Java tutorial
//package com.java2s; import android.content.Context; import android.content.pm.PackageManager; import android.hardware.Camera; public class Main { public static Camera.CameraInfo[] getCameraArray(Context context) { Camera.CameraInfo[] cameraArray = null; if (isCameraPresent(context)) { int numCameras = Camera.getNumberOfCameras(); if (numCameras > 0) { cameraArray = new Camera.CameraInfo[numCameras]; for (int ii = 0; ii < numCameras; ++ii) { cameraArray[ii] = new Camera.CameraInfo(); Camera.getCameraInfo(ii, cameraArray[ii]); } } } return cameraArray; } public static boolean isCameraPresent(Context context) { boolean hasCamera = false; if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) { hasCamera = true; } return hasCamera; } }