Tutorial by: Date: 2018-01-16 09:18:50
The AndroidManifest.xml file contains information about your package, including applications such as activities, services, broadcast receivers, content providers, etc.
It performs some other tasks also:
This is the required XML file for all Android applications and is located inside the root directory.
A simple AndroidManifest.xml file looks like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.javatpoint.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>
Elements of the AndroidManifest.xml file
The elements used in the above xml file are described below.
The manifest is the fundamental element of the AndroidManifest.xml file. There is a package feature that describes the package name of the activity class.
The application is a sub-section of the manifest. This includes namespace declaration. This element contains several sub-committees, which declares application component such as activity etc.
Typically used features include icons, labels, themes etc.
Activity is a sub-section of the application and represents an activity that should be defined in the Android manifest.exml file. It has many features like label, name, theme, launch mode etc.
Android: The label represents a label that is displayed on the screen.
Android: Name represents a name for the activity class, this feature is required
Intent-filter is the sub-element of the activity, which can respond to what activity, service or broadcast receiver, describes this type of intent
It adds an action to intent-filters, intent-filters should have at least one action element.
It adds a category name for an intention-filter