Here you can find the source of isApkInstalled(Context context, String packageName)
public static boolean isApkInstalled(Context context, String packageName)
//package com.java2s; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.util.Log; public class Main { final public static String TAG = "AK_KaedeUtil"; public static boolean isApkInstalled(Context context, String packageName) { PackageInfo packageInfo = null;/*from ww w . j av a 2 s . c o m*/ try { packageInfo = context.getPackageManager().getPackageInfo( packageName, PackageManager.GET_ACTIVITIES); } catch (NameNotFoundException e) { packageInfo = null; e.printStackTrace(); } if (packageInfo == null) { return false; } else { Log.e(TAG, packageInfo.toString()); return true; } } }