标签:style blog ar io color os sp for on
1 /** 2 * 获取到所有安装的app的基本信息 3 * @return当前手机中所有app的基本信息 4 */ 5 public List<AppInfo> getAppInfos(){ 6 7 List<AppInfo> list=new ArrayList<AppInfo>(); 8 //获取包管理器的对象 9 PackageManager packageManager=context.getPackageManager(); 10 //拿到所有已经安装成功的app的信息 11 List<PackageInfo> packageInfos=packageManager.getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES); 12 for(PackageInfo info:packageInfos){ 13 appinf=new AppInfo(); 14 //获取app的名称 15 //String name=appInfo.name; 16 ApplicationInfo appinfo=info.applicationInfo; 17 //String name=appINFO.packageName; 18 String name= appinfo.loadLabel(packageManager).toString(); 19 appinf.setAppName(name); 20 //获取到app的图标 21 Drawable icon=appinfo.loadIcon(packageManager); 22 appinf.setIcon(icon); 23 //将这些信息加入到list集合中去 24 list.add(appinf); 25 26 } 27 28 return list; 29 }
标签:style blog ar io color os sp for on
原文地址:http://www.cnblogs.com/DASOU/p/4171042.html