zoukankan      html  css  js  c++  java
  • ApplicationInfo,ResolveInfo,PackageManager

    ApplicationInfo: Information you can retrieve about a particular application. This corresponds to information collected from the AndroidManifest.xml's application
                           根据AndroidManifest.xml文件中的标签“application” 检索到特定的应用,包含activity,broadcast,service,provider。

    ResolveInfo:     Information that is returned from resolving an intent  against an IntentFilter. This partially corresponds to information collected from the AndroidManifest.xml's intent

                           根据AndroidManifest.xml文件中的标签“ intent” 检索到特定的应用。

    PackageManager: Class for retrieving various kinds of information related to the application packages that are currently installed on the device.

                           这个类关联了所有已经安装在手机上的应用,可以利用这个类的对象获取上面两种信息。

     1 代码:
     2 
     3 PackageManager manager = getPackageManager();
     4 
     5 //Return a List of all application packages that are installed on the  device. 获取所有已经安装的应用的信息。
     6 List< ApplicationInfo> appList = manager.getInstalledApplications(PackageManager.GET.UNINSTALLED_PAKAGES);
     7 
     8 // Retrieve all activities that can be performed for the given intent.仅仅是获取所有符合指定intent-filter的activity
     9 
    10 Intent intent = new Intent(Intent.A CTION_MAIN,null);
    11 intent.addCategory(Intent.CATEGORY_LAUNCHER);
    12 List< ResolveInfo> activityList = manager.queryIntentActivities(intent,0);

    拿到上面信息后,可以得到应用的icon ,label等。

                  

  • 相关阅读:
    网站抓取
    Java经典类库-Guava中的函数式编程讲解
    更快的memcpy
    Jqgrid入门-使用模态对话框编辑表格数据(三)
    深入理解.NET程序的原理 谈一谈破解.NET软件的工具和方法
    jquery跨域请求数据
    C#WebBrowser控件使用教程与技巧收集
    memcached 命令操作详解
    C#中WindowsForm常见控件的运用
    多线程实践
  • 原文地址:https://www.cnblogs.com/mogul/p/2981407.html
Copyright © 2011-2022 走看看