Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;

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

import android.text.TextUtils;

import java.util.List;

public class Main {
    public static boolean isQqInstalled(Context context) {
        final PackageManager packageManager = context.getPackageManager();
        List<PackageInfo> infos = packageManager.getInstalledPackages(0);
        if (infos != null) {
            for (PackageInfo info : infos) {
                if (TextUtils.equals(info.packageName, "com.tencent.mobileqq")) {
                    return true;
                }
            }
        }
        return false;
    }
}