Registering Activity in AndroidManifest.xml:
Activity in AndroidManifest.xml is registered inside the <application> tag using <activity> tag.
Syntax: <activity android:name=”Fully qualified name of Activity”> ——- // Some optional metadata </activity>
Ex:
<manifest xmlns:android=”http://schemas.android.com/apk/res/android” package=”com.nareshit.test”>
<application
android:allowBackup=”true”
android:icon=”@mipmap/ic_launcher”
android:label=”@string/app_name”
android:roundIcon=”@mipmap/ic_launcher_round”
android:supportsRtl=”true”
android:theme=”@style/AppTheme”>
<activity android:name=”.MainActivity”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />
<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
</activity>
<activity android:name=”.SecondActivity”></activity>
</application>
</manifest>
Note: Whichever Activivty has intent filter with action main and category launcher is the activity opens first on opening the application.