androidandroid-intentandroid-activityandroid-manifest

Manifest file structured in android studio for different activities


I want to know that how to set multiple activities by using different layouts and through intent filters

How pages set in application and what we should specify in section of activity in manifest file for action and category for different activity pages.

Please help me on that. What should I follow, So that I can make proper flow of my application

Any suggestion or references for the same would be appreciated.


Solution

  • Mainifest.xml is having more information about application.

    Activity defining is also one part of Manifest.xml, So define all the activities which are used in your app flow here. Main launcher activity will have tag with action - MAIN and category type - LAUNCHER. And other activities are defined in a simple manner.

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example">
    
        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            <activity
                android:name="com.example.LauncherActivity"
                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="com.example.ActivityA" >
            </activity>
            <activity android:name="com.example.ActivityB" >
            </activity>
            ....
        </application>
    

    There are several other attributes that you can include in this element, to define properties such as the label for the activity, an icon for the activity, or a theme to style the activity's UI.

    Follow for more: Activity

    Labels in Activity: Activity labels in Manifest.xml