Androidmainfest.xml file Analysis "Go"

Source: Internet
Author: User

Androidmanifest.xml is a required file for each Android program. It is located at the root of the application, describing the global data in the package, including the components exposed in the package (activities, services, and so on), their respective implementation classes, the various data and boot locations that can be processed.

An important part of this file is the intent-filters it contains. These filters describe where and when the activity started. Whenever an activity (or operating system) is to perform an action, such as opening a Web page or a contact book, it creates an intent object. It can carry some information describing what you want to do, what data you want to process, the type of data, and some other information. Android compares the information in the intent object and each application exposed Intent-filter to find the most appropriate activity to handle the data and actions specified by the caller.
In addition to declaring your program activities, Content Providers, Services, and intent receivers, you can also specify permissions and instrumentation (security control and testing) In the Androidmanifest.xml file.

This is a simple androidmanifest.xml.

< XML version= "1.0" encoding= "Utf-8"?>

< manifest xmlns:android= "http://schemas.android.com/apk/res/android" to make Android namespaces

Package= "Com.my_domain.app.helloactivity" > Know the Package property, Com.my_domain.app.helloactivity is also the default process name

< application android:label= "@string/app_name" >

< activity class= ". Helloactivity ">

< intent-filter>

< action android:value= "Android.intent.action.MAIN"/>

< category android:value= "Android.intent.category.LAUNCHER"/>

</intent-filter>

</activity>

</application>

</manifest>

It is worth mentioning some of the most common:

· Almost all of the androidmanifest.xml (and many other Android XML files) contained the namespace declaration xmlns:android= "Http://schemas.android.com/apk/res/android" in the first element. This allows the various standard properties in Android to be used in the file, providing the data in most of the elements.

· Most manifests contain a single < application> element that defines all application-level components and attributes and can be used in the package.

· Any package that is considered a top-level application by the user and can be used by the program launcher needs to contain at least one activity component to support the main operation and the launcher kind, as seen in the code above.

Here is a detailed list of the structure of the Androidmanifest.xml file that describes all the tags that can be used.

Manifest

Root node, which describes all the contents of the package. Under it can be placed:

Uses-permission

Ask for the security license you need to give your package a normal operation. See Securitymodel For more information on licensing. A manifest can contain 0 or more of this element.

Permission

A security license is declared to limit which programs can be components and features in your package. See Securitymodel For more information on licensing. A manifest can contain 0 or more of this element.

Instrumentation

The code that is used to test this package or other Packages directive component is declared. See instrumentation for more information on licensing. A manifest can contain 0 or more of this element.

Application

Contains the root node of the application level component declaration in the package. This element can also contain global and default attributes in application, such as tags, icons, themes, necessary permissions, and so on. A manifest can contain 0 or one of this element (no extra one is allowed). Under it can place 0 or more of the following component declarations:

Activity

Activity is the primary tool for interacting with users. When a user opens an application's initial page, an activity, most of the other pages used is also implemented by different activity and declared in another activity tag.

Note: Each activity must have a < activity> tag, whether it is used externally or only in its own package. If an activity does not have a corresponding tag, you will not be able to run it.

In addition, to support the runtime to find your activity late, you can include one or more < intent-filter> elements to describe the actions your activity supports:

Intent-filter

Declares a intent value supported by a specified set of components, thus forming a intentfilter. In addition to being able to specify different types of values under this element, attributes can also be placed here to describe the unique label, icon, and other information required for an operation.

Action

The intentaction that the component supports.

Category

The intentcategory that the component supports.

Type

The Intentdata MIME type supported by the component.

Schema

The Intentdata URI scheme supported by the component.

Authority

The Intentdata URI authority supported by the component.

Path

The Intentdata URI path supported by the component.

Receiver

Intentreceiver enables the application to obtain data changes or actions that occur even if it is not currently running. With the activity tag, you can optionally include one or more of the < intent-filter> elements supported by receiver;

Service

A service is a component that can run at any time in the background. With the activity tag, you can optionally include one or more of the < intent-filter> elements supported by receiver;

Provider

ContentProvider is a component used to manage persisted data and publish it to other applications. Androidmanifest.xml is a required file for each Android program. It is located at the root of the application, describing the global data in the package, including the components exposed in the package (activities, services, and so on), their respective implementation classes, the various data and boot locations that can be processed.

Android:allowtaskreparenting

Whether to allow activity to replace dependent tasks, such as switching from a short message task to a browser task.
--------------------------------------------------------------------------------------
Android:alwaysretaintaskstate

Whether to keep the state unchanged, such as switching back to home, and then new open, the activity is in the final state
--------------------------------------------------------------------------------------
Android:cleartaskonlanunch

For example, p is activity, Q is the activity that is triggered by P, and then returns to home, the new start P, whether to show Q
--------------------------------------------------------------------------------------
Android:configchanges

Whether the onconfigurationchanged () method such as "Locale|navigation|orientation" is called when the configuration list changes.
--------------------------------------------------------------------------------------

Android:enabled

Whether the activity can be instantiated,
--------------------------------------------------------------------------------------

Android:excludefromrecents

Whether it can be displayed in the recently opened Activity list
--------------------------------------------------------------------------------------
android:exported

Whether activity is allowed to be called by other programs
--------------------------------------------------------------------------------------
Android:finishontasklaunch

Whether to close open activity when the user restarts the task
--------------------------------------------------------------------------------------
Android.icon
--------------------------------------------------------------------------------------
Android:label
--------------------------------------------------------------------------------------
Android:launchmode

Activity start mode, "standard" "Singletop" "Singletask" "singleinstance" of which the first two is a group, the latter two as a group
--------------------------------------------------------------------------------------

Android:multiprocess
Allow multi-process
--------------------------------------------------------------------------------------
Android:name

The class name of the activity, which must be specified

--------------------------------------------------------------------------------------
Android:onhistory
Whether you need to remove this activity when the user switches to another screen. This attribute is introduced in API level 3.
--------------------------------------------------------------------------------------

Android:permission
--------------------------------------------------------------------------------------
Android:process
The name of the process in which the activity is run, and all program components run in the application's default process, which is the same name as the application's package name. The element process property in <application> can set a new default value for all components.  But any component can override this default value, allowing you to put your program in a multi-process run. If this property is assigned the name begins with: When the activity is running, a new process dedicated to the program will be created. If the process name starts with a lowercase letter, the activity will run in the global process and be provided by its permission.
--------------------------------------------------------------------------------------

Android:screenorientation

Activity shows the mode, "unspecified" default value "Landscape" landscape mode, the width is larger than the height of "Portrait" portrait mode, height is larger than the width. "User" users ' settings "behind" "Sensor" "Nosensor"

--------------------------------------------------------------------------------------

android:statenotneeded

Whether the activity is destroyed and successfully restarted does not save the state

--------------------------------------------------------------------------------------

Android:taskaffinity

The activity's kinship, by default, has the same relationship as the activity under an application

--------------------------------------------------------------------------------------

Android:theme

Activity's style theme, if not set, the activity's theme style belongs to the application, see the <application> element's Theme property
--------------------------------------------------------------------------------------

Android:windowsoftinputmode

Interactive mode of Activity main window and soft keyboard, since API Level 3 was introduced

According to HTTP://BLOG.CSDN.NET/K7SEM/ARTICLE/DETAILS/4527250

http://blog.163.com/huang_jianhao/blog/static/18248010320117123917625/

Finishing

Androidmainfest.xml file Analysis "Go"

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.