SHARE
TWEET

Untitled

a guest Dec 13th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private List<AppList> getInstalledApps() {
  2.     List<AppList> res = new ArrayList<AppList>();
  3.     List<PackageInfo> packs = getPackageManager().getInstalledPackages(0);
  4.     for (int i = 0; i < packs.size(); i++) {
  5.         PackageInfo p = packs.get(i);
  6.         if ((isSystemPackage(p) == false)) {
  7.             String appName = p.applicationInfo.loadLabel(getPackageManager()).toString();
  8.             Drawable icon = p.applicationInfo.loadIcon(getPackageManager());
  9.             String package_name = p.applicationInfo.packageName;
  10.             res.add(new AppList(appName, package_name, icon));
  11.         }
  12.     }
  13.  
  14. private boolean isSystemPackage(PackageInfo pkgInfo) {
  15.     return ((pkgInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) ? true : false;
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top