-2

谁能告诉我如何从一个应用程序打开多个 apk 文件。我现在已经为 Carousel 做了一个应用程序,而当用户单击该图标时,它应该打开该特定应用程序的 apk 文件,同样我在 Carousel 中有 6 个项目。我知道它可以由 onItemClickListener 完成我只想知道如何从应用程序打开 apk 文件。

谢谢

4

2 回答 2

0

在打开新应用程序之前,您应该知道应用程序包名称,

 Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setComponent(new ComponentName("com.package.address","com.package.address.MainActivity"));
    startActivity(intent);

或者

Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
startActivity(LaunchIntent);
于 2013-07-23T05:58:49.400 回答
0

Those items you are showing up in the carousel are static? or are you reading them from Intent using some category filter? If it's the last one, you could save the packageName reading the List<ResolveInfo> returned when you query your packageManager.

Here you can see an example of what I'm talking about: How to get package name of camera application

于 2013-07-23T06:40:04.170 回答