Jump to content

timcph2008

Members
  • Posts

    1
  • Joined

  • Last visited

Previous Fields

  • Languages
    English, Cantonese, Mandarin

Profile Information

  • Interests
    Hi guys, I just learn Java by myself during summer 2014. And I am learning Android Application mainly. If you also interested in Android Application, lets be friend and share info :D!!

timcph2008's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. 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);
×
×
  • Create New...