发布网友 发布时间:2022-04-27 09:41
共1个回答
热心网友 时间:2023-09-21 19:45
Android应用只存在应用名,不存在应用中文名,你要获取的是不是主界面图标底下的名字?
ArrayList<AppInfo> appList = new ArrayList<AppInfo>(); //用来存储获取的应用信息数据
List<PackageInfo> packages = getPackageManager().getInstalledPackages(0);
for(int i=0;i<packages.size();i++) { PackageInfo packageInfo = packages.get(i); AppInfo tmpInfo =new AppInfo(); tmpInfo.appName =packageInfo.applicationInfo.loadLabel(getPackageManager()).toString(); tmpInfo.packageName = packageInfo.packageName; tmpInfo.versionName = packageInfo.versionName; tmpInfo.versionCode =packageInfo.versionCode; tmpInfo.appIcon = packageInfo.applicationInfo.loadIcon(getPackageManager()); appList.add(tmpInfo);
}