Android的 - 简单的方法来显示已安装的应用程序,或教程? [英] Android - simple way to display installed apps, or tutorial?
问题描述
没有任何人有一个简单的code,以显示一个列表(列表视图?)所有安装在手机上的应用程序,并且点击时让用户打开一个?
Does anybody have a simple code to display a list (list view?) of all the apps installed on a phone, and have the user open one when clicked?
甚至是应用程序的抽屉。我只是需要一种方法来让用户打开的所有应用程序。
Or even an App drawer. I just need a way to have the user open all of their apps.
我试图寻找教程,但找不到任何和我下载的例子回家的Android,但我绝对讨厌翻翻code和挖掘出我想要的。
I have tried searching for tutorials, but couldn't find any, and I downloaded the example home from Android, but I absolutely hate looking through code and digging out what I Want.
推荐答案
有一个看的首页示例应用程序自带的SDK。
Have a look at the Home sample application that comes with the SDK.
的基本思想是使用 PackageManager 以获得任
The basic idea is to use PackageManager to get either
- 在所有安装的软件包使用
getInstalledPackages
或列表 - 使用
queryIntentActivities
与类别CATEGORY_LAUNCHER
和行动ACTION_MAIN
- a list of all installed packages using
getInstalledPackages
or - a list of all launcher activities using
queryIntentActivities
for an intent with categoryCATEGORY_LAUNCHER
and actionACTION_MAIN
这取决于你的使用情况。
depending on your use case.
这篇关于Android的 - 简单的方法来显示已安装的应用程序,或教程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!