Manifest file Meta-data Tags

Source: Internet
Author: User

See: http://www.android-doc.com/guide/topics/manifest/meta-data-element.html


Meta-data, like its name, is used primarily to define some component-related configuration values .

By official definition, metadata is a set of name-value pairs (Name-value pair) that are used by the parent component, so the corresponding meta-data element should be defined in the corresponding component. That is, if you want to use metadata in activity, then meta-data must be defined in Androidmanifest.xml's activity statement.


In the Activity app <meta-data> elements.

Activityinfo info = this. Getpackagemanager (). Getactivityinfo (Getcomponentname (), packagemanager.< C3>get_meta_data); info. metaData. getString ("Meta_name");          //In application applications <meta-data> elements. applicationinfo appInfo = this. Getpackagemanager (). Getapplicationinfo (Getpackagename (), Pack Agemanager. get_meta_data); AppInfo. metaData. getString ("Meta_name");         //In service apps <meta-data> elements. componentname cn = New componentname (This, MetadataService. Class); serviceinfo info = this. Getpackagemanager (). GetServiceInfo (CN, Packagemanager. Get_meta_data); info. metaData. getString ("Meta_name");          //In receiver applications <meta-data> elements. componentname cn = New componentname (This, metadatareceiver. Class); activityinfo info = this. Getpackagemanager (). Getreceiverinfo (CN, Packagemanager. Get_meta_data); info. metaData. getString ("Meta_name");




From for notes (Wiz)

Manifest file Meta-data Tags

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.