Android - Simple Way To Display Installed Apps, Or Tutorial?
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 w
Solution 1:
Have a look at the Home sample application that comes with the SDK.
The basic idea is to use PackageManager to get either
- 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.
Solution 2:
Here you can get all the installed application.Write code to achieve additional requirement
List<ApplicationInfo> packages;
PackageManager pm;
pm = getPackageManager();
get a list of installed apps.
packages = pm.getInstalledApplications(0);
ActivityManager mActivityManager = (ActivityManager) context
.getSystemService(Context.ACTIVITY_SERVICE);
for (ApplicationInfo packageInfo : packages) {
//packageInfo.packageName is the name of the package
}
Solution 3:
Just check this code snippets posted here: http://www.androidsnippets.com/get-installed-applications-with-name-package-name-version-and-icon , you can have all the installed application.
Solution 4:
Rasel's Code worked ok for me.
Here is the full code: ( would love to see some more comments so I understand why it works!)
List<ApplicationInfo> packages;
PackageManagerpm= getPackageManager();
packages= pm.getInstalledApplications(0);
Log.v("Alert","package is "+packages);
for (ApplicationInfo packageInfo : packages) {
String tempinfo= packageInfo.packageName;
Log.v("Alert","this is working"+ tempinfo);
Post a Comment for "Android - Simple Way To Display Installed Apps, Or Tutorial?"