Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.lang.reflect.Method;

import android.content.Context;

import android.content.pm.PackageManager;

public class Main {
    public static boolean hasSystemFeature(final Context pContext, final String pFeature) {
        try {
            final Method PackageManager_hasSystemFeatures = PackageManager.class.getMethod("hasSystemFeature",
                    new Class[] { String.class });
            return (PackageManager_hasSystemFeatures == null) ? false
                    : (Boolean) PackageManager_hasSystemFeatures.invoke(pContext.getPackageManager(), pFeature);
        } catch (final Throwable t) {
            return false;
        }
    }
}