AndroidManifest.xml

AndroidManifest.xml file contains information about your packages including components of your application like services, actvities, content providers, broadcast receievers etc. 

AndroidManifest.xml file looks like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.hello"
    android:versionCode="1"
    android:versionName="1.0" >
  
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />
 
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                  <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
  
</manifest>


Lets have a look on elements of the AndroidManifest.xml

<manifest>
<manifest> is the root element of AndroidManifest.xml file. It has package attribute that describes that package name of the activity class.

<application>
<application> is the subelement of the manifest. It includes the namespace declaration. This element contains several subelements that declares the application component such as activity etc.
The commonly used attributes are of this element are icon, label, theme etc.

android:icon represents the icon for all the application components.

android:label works as the default label for all the application components. It should be set as a reference to string resource.

android:theme represents a common theme for all the activities.

<activity>
<activity> is the subelement of application and represents an activity. Each activity must be defined in the AndroidManifest.xml file. It has many attributes such as name, label etc.

android:label represents a label for the activity, often displayed on the screen.

android:name represents a name for the activity class. It is required attribute.

<intent-filter>
intent-filter is the subelement of activity and describes the type of intent to which activity, service or broadcast receiver can respond to.

<action>
It adds an action for the intent-filter. The intent-filter must have one or more action elements.

<category>
It adds an category name to an intent-filter.

Comments

Popular posts from this blog

SQLiteDatabase (Without SqliteOpenHelper class)

Set current date to Button and Datepicker dialog

MVC Architecture in Android