Skip to content Skip to sidebar Skip to footer

How Change Default On Launch Module In Android Studio?

I have two modules in my android studio project. One module displays 'Hello World' on screen, and the other module displays 'Hello Module' on screen. How to decide, which module to

Solution 1:

Before the apk is generated, all the manifests in your project are combined in a process called as manifest-merging. So you should be able to change launcher activity by moving the following intent-filter from your old launcher activity to the new launcher activity:

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Solution 2:

Since Veneet Reddy has given the correct idea about your problem, I'm about to give you this solution in the manifest file do it like this :

<activity android:name=".YourDesiredActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

This is the way to do this. However the Manifest file will be seen in the android studio in your left window pane and do remember to choose the Android option from above the menu See the image you'll get a better idea.

Android Manifest File Picture

Happy Learning!


Solution 3:

Every module has a build.gradle file inside. The module which has apply plugin: 'com.android.application' in it's corresponding build.gradle file is supposed to be the base module of the application.

A module can have more than one activity. The AndroidManifest.xml file inside the base module should have it's activities in there. The activity we need to run on app starting has to contain the following codes inside the opening and closing tags of the activity.

<intent-filter>
 <action android:name="android.intent.action.MAIN" />
 <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Post a Comment for "How Change Default On Launch Module In Android Studio?"