Android examples for Camera:Camera Feature
Returns the number of cameras accessible to the Android API.
//package com.java2s; import java.lang.reflect.Method; import android.hardware.Camera; import android.util.Log; public class Main { public static int numberOfCameras() { try {// w ww.jav a2 s .co m Method m = Camera.class.getMethod("getNumberOfCameras"); return ((Number) m.invoke(null)).intValue(); } catch (Exception ex) { Log.d("number of cameras", "((())) " + ex); ex.printStackTrace(); return 1; } } }