Jump to content
Sign in to follow this  
timcph2008

Question about list of Installed application in Android phone.

Recommended Posts

Hi guys,

I wanna create a list of the installed application for practice.

the following code is from another post: https://buckysroom.org/forum/topic.php?id=503
I used the code that they suggest, but there has some errors.
app cannot be resolved to a variable
pm cannot be resolved
apps cannot be resolved to a variable
How should I change it?
Also, what the pm and apps are in the apps?
Thank you so much for your help!!
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) {        installedApps.add(app);    //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 {        installedApps.add(app);    }} String label = (String)pm.getApplicationLabel(app);Drawable icon = pm.getApplicationIcon(app);

 

Share this post


Link to post
Share on other sites

Is that all the code you have? Those error messages mean that you are using variables that don't exist.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...