We all know that for multiple activity, if you are in the same package, you can register in Mainfest
XML code
- <span style="Font-size:small;" ><? XML version= "1.0" encoding="Utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.trinea.sns.activity"
- android:versioncode="1"
- android:versionname="1.0">
- <uses-sdk android:minsdkversion="3" />
- <uses-permission android:name="Android.permission.INTERNET" />
- <application android:icon="@drawable/icon" android:label="@string/app_name" >
- <activity android:name=". Updatestatusactivity "
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="Android.intent.action.MAIN" />
- <category android:name="Android.intent.category.LAUNCHER" />
- </intent-filter>
- </Activity>
- <activity android:name=". Viewsnsactivity "
- android:label="@string/app_name">
- </Activity>
- </Application>
- </manifest></span>
The above updatestatusactivity and viewsnsactivity are also defined below the package com.trinea.sns.activity, but if
Updatestatusactivity under the bag com.trinea.sns.activity, and viewsnsactivity under the bag com.trinea.sns.activity2 what to do?
Each activity, service, and other application component will correspond to a <activity>, <service> tag in the Androidmanifest.xml file. There is a required attribute in these tags:android:name, which needs to specify a class name, like the one above. Updatestatusactivity and Android.intent.action.MAIN. Did you find out the difference between the two? The first one is. The way and the second is the full path. There are 3 ways to specify the value of the Android:name property, as follows:
1. Specify the full class name (Packagename+classname), for example, Net.blogjava.mobile.Main.
2. specify only the class name , for example,. Main, where main is preceded by "." is optional. The package name in which the class is located needs to be specified in the <manifest> tag's packages property.
3. specify the relative class name , which is similar to the 2nd way, except that the class name is not specified in the Android:name attribute of the <activity> tag, and there are some package names. For example, if the main class is in the NET.BLOGJAVA.MOBILE.ABCD package, you can specify Net.blogjava.mobile in the Packages property of the <manifest> tag, and then <activity The Android:name property of the > tag is specified in the. Abcd.main.
Thus, the purpose of the package is to make it easier to specify the value of Android:name and other related properties, which is a default packet. If you do not specify a package name in Android:name, the value of the packages attribute is automatically added to the previous
Reference: HTTP://DEVELOPER.ANDROID.COM/GUIDE/TOPICS/MANIFEST/ACTIVITY-ELEMENT.HTML#NM
Androidmanifest.xml add different packages in the component (Activity, service android:name specified value is usually a period plus class name), you can specify the full class name (package name + class name) to resolve