Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Context;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import java.util.List;

public class Main {
    public static boolean isAvilible(Context context, String packageName) {
        PackageManager packageManager = context.getPackageManager();
        List pinfo = packageManager.getInstalledPackages(0);

        for (int i = 0; i < pinfo.size(); ++i) {
            if (((PackageInfo) pinfo.get(i)).packageName.equalsIgnoreCase(packageName)) {
                return true;
            }
        }

        return false;
    }
}