Androidmanifest.xml Profile for Android application development is a relatively thin but very important basic knowledge, this article is intended to summarize the configuration files commonly used in several properties, for later review, as for those more fine attributes, mainly in peacetime development less use will not enumerate, if you have to directly in the ECL Ipse in the direct "alt+/" just fine ...
The following is a more general example of a Androidmanifest.xml file (the project catalog is test),
<?XML version= "1.0" encoding= "Utf-8"?><Manifestxmlns:android= "Http://schemas.android.com/apk/res/android" Package= "Com.example.test"Android:versioncode= "1"Android:versionname= "1.0" > <!--requirements for the SDK version - <USES-SDKandroid:minsdkversion= "+"android:targetsdkversion= "+" /> <!--Get system-related permissions configuration if you do not know how many properties of the system, do not bother to search, directly in the name of the double quotation mark note alt+/is good, more direct ~ - <uses-permissionAndroid:name= "Android.permission.ACCESS_WIFI_STATE"/> <!--application Configuration Details
icon is icons;
The label is the name of the program displayed in the TitleBar.
Theme is the theme of the whole program, here is the theme of their own file definition, if you want to use Android is @android:style/theme and add alt+/can choose freely
- <ApplicationAndroid:allowbackup= "true"Android:icon= "@drawable/ic_launcher"Android:label= "@string/app_name"Android:theme= "@style/apptheme" >
<!--Activity Configuration - <activity
Android:name=". Mainactivity "Android:label= "@string/app_name" > <Intent-filter> <ActionAndroid:name= "Android.intent.action.MAIN" /> <categoryAndroid:name= "Android.intent.category.LAUNCHER" /> <DataAndroid:host= "Mainactivity"/> </Intent-filter> </Activity> <!--Service Configuration - <Service> <Intent-filter> <Action/> <category/> <Data/> </Intent-filter> </Service> <!--Receive Configuration - <receiver> <Intent-filter/> <Meta-data/> </receiver> <!--provider Configuration - <provider> <grant-uri-permission/> <Meta-data/> <path-permission/> </provider> <!--external libraries required by the program - <uses-library/> </Application></Manifest>
Throughout the system component configuration above, basically have a intent-filter attribute, to the system in a variety of chaotic intent filter processing. Because the Android system will always send a variety of messages of various intent, some of the system is issued by some of the various programs, how to get from so many messages you want? Then filter, Intent-filter is the role. Here we come to the details of this intent-filter related properties, although the intent-filter of the various components are different, but understand the approximate, basic is similar, extrapolate, comprehend by analogy.
The intent message also contains several important attributes for name, action, data, and category, and there are some differences between these points due to the different labels being filtered.
The <action> tag is used to describe the name of the specific message;
<category> tags are used to represent categories that can handle message components;
The <data> tag is used to describe the data format that the message needs to process, and it supports the use of regular expressions to qualify the data source;
For example, the following is an activity intent-filter:
<Intent-filter> <ActionAndroid:name= "Wytings msg" /> <categoryAndroid:name= "Android.intent.category.DEFAULT" /> <DataMimeType="*/*" /> </Intent-filter>
As long as the system has a program issued by intent Action for Wytings msg This activity can be received.
The category setting is the default configuration, The general category is mainly Android.intent.category.DEFAULT and Android.intent.category.LAUNCHER two (the former is the default configuration, see how the action is set, how to start, the latter is the first start of the basic Have to and <action android:name= "Android.intent.action.MAIN"/> together with), other look at their own needs, if still do not know or alt+/is good.
The processing type is set in data, meaning the message I received, if it is not my type of processing, I still do not work. For example, we set the action above to Android.intent.action.SEND (meaning that when we send a point, the system will invoke the activity, there is a prerequisite is that the file sent to it is supported, here is what the file type is supported)
A detailed analysis of the androidmanifest.xml and Intent-filter