final List<PackageInfo> packs = getPackageManager().getInstalledPackages(0);
上面的 PackageInfo 类用于获取包列表然后
获取包名称:
ViewHendler hendler = new ViewHendler();
hendler.textLable = (TextView)convertView.findViewById(R.id.textView);
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage(packageName);
startActivity( LaunchIntent );
然后使用包名调用启动应用程序:launchApp(packageName)
void launchApp(String packageName) {
Intent mIntent = getPackageManager().getLaunchIntentForPackage(packageName);
if (mIntent != null) {
try {
startActivity(mIntent);
} catch (ActivityNotFoundException err) {
Toast t = Toast.makeText(getApplicationContext(),
R.string.app_not_found, Toast.LENGTH_SHORT);
t.show();
}
}
}
但没有得到结果(从我的应用程序启动另一个应用程序)。