1. public boolean isAvilible(Context context, String packageName) {
2. PackageManager packageManager = context.getPackageManager();
3.
4. //获取手机系统的所有APP包名,然后进行一一比较
5. List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);
6. for (int i = 0; i < pinfo.size(); i++) {
7. if (((PackageInfo) pinfo.get(i)).packageName
8. .equalsIgnoreCase(packageName))
9. return true;
10. }
11. return false;
12. }
跳转应用市场
try {
Intent intent = new Intent();
Uri uri =Uri.parse("market://details?id=" + "com.client.guomei");
intent = newIntent(Intent.ACTION_VIEW, uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
} catch (Exception e) {
Toast.makeText(this, "您没有安装应用市场",Toast.LENGTH_SHORT).show();
}