Check if this device has a camera - Android Camera

Android examples for Camera:Camera Feature

Description

Check if this device has a camera

Demo Code


//package com.java2s;

import android.content.Context;
import android.content.pm.PackageManager;

public class Main {
    /** Check if this device has a camera */
    public static boolean checkCameraHardware(Context context) {
        if (context.getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_CAMERA)) {
            // this device has a camera
            return true;
        } else {//from w  ww  .j a v a  2 s .  c  o  m
            // no camera on this device
            return false;
        }
    }
}

Related Tutorials