Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.pm.PackageManager; import android.widget.Toast; public class Main { public static boolean checkCameraHardware(Context context) { if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) { return true; } else { Toast.makeText(context, "No camera on this device", Toast.LENGTH_SHORT).show(); return false; } } }