Search code examples
androidandroid-intentandroid-manifestandroid-launcher

How can I give two different names for two launch-able activities?


I noticed that

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

This part above can make icons.

So, This code will create two icons after installing one apk. But those launch different activity each-A_Activity or B_Activity

        <activity
            android:name=".ui.A_Activity"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.B_Activity"
            android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

But anyway, this acts like one app after launching one of them. After launching A_Activity, it can reach the other Activities or Resources that B_Activity moves to or uses if the implementation is the similar or the same.

However, what I want to know is making two different names for each icon. Mine has two icons but the same name. Is there any way to give different app names for them? Because I wanna test two different modes at the same time after installing it.


Solution

  • The text underneath the icon on the HOME screen is taken from the

    android:label="..."
    

    attribute of the <activity> description in the manifest. If you don't provide this, it uses the android:label of the <application>.

    So all you need to do is to provide different android:label strings for each <activity> in the manifest.