首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

Android判断运用是否存在

2012-08-24 
Android判断应用是否存在通过包名判断?Intent intent new Intent(Intent.ACTION_VIEW)intent.setClassN

Android判断应用是否存在

通过包名判断

?

Intent intent = new Intent(Intent.ACTION_VIEW);intent.setClassName("com.android.settings", //$NON-NLS-1$"com.android.settings.InstalledAppDetails"); //$NON-NLS-1$intent.putExtra("com.android.settings.ApplicationPkgName", //$NON-NLS-1$mCurrentPkgName);List<ResolveInfo> acts = getPackageManager().queryIntentActivities(intent, 0);if (acts.size() > 0) {startActivity(intent);} else {Toast.makeText(this,getString(R.string.failed_to_resolve_activity),Toast.LENGTH_SHORT).show();}

?

热点排行