在我的应用中,我想要这样:
用户点击按钮 - >在屏幕上显示所有已安装的应用程序及其图标(因为我们在同一索引中的移动屏幕中)。
点击已安装的应用程序图标时,打开特定的点击应用程序。
任何人给我任何想法或演示如何做到这一点? 提前谢谢。
答案 0 :(得分:2)
您可以获取所有已安装的应用的列表:
final List<ApplicationInfo> pkgAppsList = context.getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA);
for(ApplicationInfo app : pkgAppsList)
{
// here you will get all the properties of the app
// Launch app
Intent i= getPackageManager().getLaunchIntentForPackage(app.packageName);
startActivity(i);
}
答案 1 :(得分:0)
final PackageManager pm = getPackageManager();
//get a list of installed apps.
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo packageInfo : packages) {
Log.d(TAG, "Installed package :" + packageInfo.packageName);
Log.d(TAG, "Source dir : " + packageInfo.sourceDir);
Log.d(TAG, "Launch Activity :" + pm.getLaunchIntentForPackage(packageInfo.packageName));
}
此处有更多信息http://qtcstation.com/2011/02/how-to-launch-another-app-from-your-app/
来自How to get a list of installed android applications and pick one to run