Android Application Descriptor File - AndroidManifest.xml
Each Android application has a manifest file named
AndroidManifest.xml
in the project's root directory. It descibes the application components.
For example, our "
Hello
" application, with an activity HelloAndroid
, has the following manifest (generated automatically by the Eclipse ADT):<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.mytest" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".HelloAndroid" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
- The
<manifest>
element specifies the package name. It contains one<application>
element. - The
<application>
element specifies the icon and label used in mobile device's "apps" menu. It contains one ore more<activity>
elements. - This application has one activity named
HelloAndroid
. The<activity>
element declares its program name (.HelloAndroid
where'.'
is relative to the packagecom.mytest
); and label (displayed as window title). It may contain<intent-filter>
. - The
<intent-filter>
declares that this activity is the entry point (android.intent.action.MAIN
) of the application when launched (android.intent.category.LAUNCHER
).
Beside declaring the application's components, it also provides references to external libraries, and specifies the permissions.
No comments :
Post a Comment
Your Comment and Question will help to make this blog better...