I wanna create an list of the apps that I installed,but where should I start?

0 Walker Cheung · June 16, 2014

I am learning java this summer, and I am want to create a list that can shows all the installed apps. I saw the youtube tutorial, and now I an in the 40th one. I know how to create a list with some string array. But how can I get the info. about the other apps in the phone? Is there any method could be used?

Thank you so much for your help! 

Post a Reply


Oldest  Newest  Rating
0 Vishnu Gt · June 17, 2014

List<ApplicationInfo> installedApps = new ArrayList<ApplicationInfo>();

for(ApplicationInfo app : apps) {
//checks for flags; if flagged, check if updated system app
if((app.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) == 1) {
//it's a system app, not interested
} else if ((app.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
//Discard this one
//in this case, it should be a user-installed app
} else {

String label = (String)pm.getApplicationLabel(app);
Drawable icon = pm.getApplicationIcon(app);

If you want to add 

The above code will do.  It will add the installed application names to the string installedApps.  If you want the Application name and icon of the installed application use the last two lines.
0 Walker Cheung · June 21, 2014
Thank you so much for your help!!

I try to use the code, but there has some errors.

app cannot be resolved to a variable
pm cannot be resolved
apps cannot be resolved to a variable

I define the app as 
ApplicationInfo app; 
does it correct?

Also, what are the pm and apps?
How should I change it?
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator