Purpose - Check if Camera is present. - Android Phone

Android examples for Phone:Camera

Description

Purpose - Check if Camera is present.

Demo Code


//package com.java2s;

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

public class Main {
    /**/*ww  w .  j a  v  a  2 s  .  co m*/
     * Purpose - Check if Camera is present.
     * 
     * @param context Current Activity\Context from which this method is called
     * */
    public static boolean IsCameraPresent(Context context) {
        if (context == null)
            return false;
        PackageManager pm = context.getPackageManager();
        return (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA));
    }
}

Related Tutorials