class PInfo {
private String appname = "";
private String pname = "";
private String versionName = "";
private int versionCode = 0;
private Drawable icon;
private void prettyPrint() {
log(appname + "\t" + pname + "\t" + versionName + "\t" + versionCode + "\t");
}
}
private void listPackages() {
ArrayList<PInfo> apps = getInstalledApps(false); /* false = no system packages */
final int max = apps.size();
for (int i=0; i<max; i++) {
apps.get(i).prettyPrint();
}
}
private ArrayList<PInfo> getInstalledApps(boolean getSysPackages) {
ArrayList<PInfo> res = new ArrayList<PInfo>();
List<PackageInfo> packs = getPackageManager().getInstalledPackages(0);
for(int i=0;i<packs.size();i++) {
PackageInfo p = packs.get(i);
if ((!getSysPackages) && (p.versionName == null)) {
continue ;
}
PInfo newInfo = new PInfo();
newInfo.appname = p.applicationInfo.loadLabel(getPackageManager()).toString();
newInfo.pname = p.packageName;
newInfo.versionName = p.versionName;
newInfo.versionCode = p.versionCode;
newInfo.icon = p.applicationInfo.loadIcon(getPackageManager());
res.add(newInfo);
}
return res;
}
http://www.androidsnippets.org/snippets/70/
相关推荐
PyQt, with its rich set of widgets and seamless integration with Python, offers a powerful toolkit for creating sophisticated and visually appealing applications. By mastering Python and PyQt, ...
List<ApplicationInfo> installedApps = packageManager.getInstalledApplications(PackageManager.GET_META_DATA); ``` `getInstalledApplications()`方法返回一个`ApplicationInfo`对象的列表,每个`...
标题中的"Get_installed_applications.rar_delphi list"表明这是一个使用Delphi编程语言开发的小型应用程序,其主要功能是获取用户操作系统上已经安装的应用程序列表。Delphi是一种基于Object Pascal的集成开发环境...
if (packageManager.checkPermission(Manifest.permission.READ_EXTERNAL_STORAGE, packageInfo.packageName) == PackageManager.PERMISSION_GRANTED) { storageAccessApps.add(packageInfo); } } ``` 这里,`...
List<ApplicationInfo> installedApplications = getPackageManager().getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES); ``` 或者在遍历时检查`ApplicationInfo.FLAG_SYSTEM`标志位是否被...
The first stable version of CoreOS Linux was made available in July 2014 and since has become one of the most commonly used operating system for containers. What You'll Learn Use Kubernetes with ...
Easy to use and modern user interface allows to comfortably work with Uninstall Tool. Multilingual interface! Translate to your language and get it for free! Option to replace Add/Remove program ...
For the best experience, have the latest version of Node installed (at least version 7). You can test most examples in the console of Chrome or other modern web browser. If you'd like to run the tests...
Several examples of ready-to-use code are provided to get you started and to continue to support applications with embedded T-SQL queries. Report designers will find this book to be a go-to ...
注意,`getInstalledApplications()`方法返回的是一个`ApplicationInfo`对象列表,包含了应用的详细信息,我们通过`packageName`字段获取包名。 一旦获取到目标应用的包名,就可以启动该应用。这需要用到`Intent`来...
You'll find out how to connect to the internet, change your desktop settings, and you'll get a tour of installed applications. Next, you'll take your first steps toward being a Raspberry Pi expert by...
标题和描述中提到的问题是关于Apache Tomcat服务器的管理Web应用程序不再默认安装的情况。这个问题从Tomcat 5.5版本开始出现,用户需要手动下载并安装“admin”包来使用管理工具。以下是如何解决这个问题的详细步骤...
Drawable icon = packageManager.getApplicationIcon(packageName); ``` 通过分析这个源码Demo,学生不仅可以了解Android中如何调用系统闹钟,还能学习到获取应用信息的方法,这对于完成毕业设计或者深入理解...
1.点击Preferences>BrowsePackages菜单 2.进入打开的目录的上层目录,然后再进入Installed Packages/目录 3.下载Package Control.sublime-package并复制到Installed Packages/目录 4.重启SublimeText。
List<ApplicationInfo> installedApps = packageManager.getInstalledApplications(PackageManager.GET_META_DATA); for (ApplicationInfo app : installedApps) { if (!app.packageName.equals(context....
3.Download Package Control.sublime-package and copy it into the Installed Packages/ directory 4. Restart Sublime Text --------------------- Package Control 安装成功的验证 5.按住Ctrl + shift + p,输入...
"Installed Applications Manager开源版"是一款专为用户提供便捷的软件管理体验的工具,它主要替代了Windows操作系统中的控制面板小程序——“添加/删除程序”。这款工具不仅提供了命令行接口,还包含了一个图形用户...
List<ApplicationInfo> installedApps = packageManager.getInstalledApplications(PackageManager.GET_META_DATA); for (ApplicationInfo appInfo : installedApps) { String packageName = appInfo.packageName;...