Android examples for Phone:Camera
has Camera
//package com.java2s; import android.annotation.TargetApi; import android.content.Context; import android.content.pm.PackageManager; import android.hardware.Camera; import android.os.Build; public class Main { @TargetApi(Build.VERSION_CODES.GINGERBREAD) public static boolean hasCamera(Context c) { PackageManager pm = c.getPackageManager(); boolean hasFeature = pm .hasSystemFeature(PackageManager.FEATURE_CAMERA); if (hasFeature && hasGingerbread()) { return Camera.getNumberOfCameras() > 0; }// ww w .j a va 2 s. com return hasFeature; } public static boolean hasGingerbread() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD; } }