Summary of info classes

Source: Internet
Author: User

First, let's take a look. Packageiteminfo, It is a base class that contains some information. Its direct subclasses include: Applicationinfo , Componentinfo , Instrumentationinfo , Permissiongroupinfo , Permissioninfo . Its indirect subclasses include: Activityinfo ,Providerinfo , Serviceinfo . The information contained in this class is equal for all projects in the package. These Package items Yes Package Manager . This class provides basic settings for attributes: Label , Icon And Meta-daTa . This class is not intended to be called by itself. It is simply shared herePackage Manager All Items . For example, it is not implemented by itself Parcelable Interface, but it helps to implement Parcelable Subclass provides a convenient method.

ApplicationinfoIs the information obtained from a specific application. The information is relativeAndrodimanifest. xmlOf<Application>Tag.

ResolveinfoThis class resolvesIntentfilterCorrespondingIntentThe obtained information. It partially corresponds toAndroidmanifest. xmlOf<Intent>Tag Information.

PackagemanagerThis class is used to return information about various packages associated with the applications currently mounted to the device. You can useGetpacagemanagerTo obtain this class.

ApplicationinfoAndResolveinfoComparison: the former can obtainIcon,Label,Meta-daTa,Description. The latter can only getIcon,Label.

The following describes the specific applications that combine these categories:

By callingPackagemanagerYou can get two different types of information:

First, you must obtainManager:

 
1 Packagemanager Manager=Getpackagemanager ();

Method 1:

List <applicationinfo> applist = manager. getinstalledapplications (packagemanager. Get. uninstalled_pakages );

It is resolved throughAndroidmanifest. xmlOf<Application>Label, so it can get allApp.

Method 2:

 1   Intent intent  =     New  Intent (intent. A ction_main,  Null  );
2
3 Intent. addcategory (intent. category_launcher );
4
5 List < Resolveinfo > Applist = Manager. queryintentactivities (intent, 0 );

It is resolved through<Intent-filter>The tag is

1 <Action Android: Name="Android. Intent. Action. Main"/>
2
3 <Action Android: Name="Android. Intent. Category. launcher"/>

app, , so we get less than the first method (the former is more than the service , previder and other app ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.