让安装的应用程序programmattically [英] getting installed applications programmattically
本文介绍了让安装的应用程序programmattically的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想点击一个图标后得到的Android安装的应用程序。根据图标点击code我写以下code:
I am trying to get the installed application in android after clicking a icon. Under the icon click code I wrote following code:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.ACTION_ALL_APPS);
startActivity(intent);
但它杀死的应用程序。我想在屏幕上显示已安装应用程序时,我们看到在Android时preSS的应用程序编程键一样。
But it kills the application. I want to show the installed applications on the screen programmatically like when we see when press app key on android.
这可能吗?
我在哪里做错了吗?
谢谢你在前进。
Is it possible? where am I doing wrong? Thank you in advance.
推荐答案
要获得所有安装的应用程序,你可以使用下面的code的列表
To get list of all installed application you can use the following code
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List pkgAppsList = getPackageManager().queryIntentActivities( mainIntent, 0);
这篇关于让安装的应用程序programmattically的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文