Android examples for android.hardware:Camera State
Check if hardware has Camera
import android.content.Context; import android.content.pm.PackageManager; public class Main { public static boolean hasCamera(Context context) { return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA) || context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT); }// w w w . java 2 s. co m }