Setting app name in application label isn't working

chrissik picture chrissik · Feb 20, 2013 · Viewed 10.2k times · Source

So I've got an Android App with an generated Login Screen (the one you can directly create from Eclipse). That's working. The problem is this: I've set the Login screen to be the Launcher activity. This works. Unfortunately the App is then called as the label parameter of the login activity. Meaning the android:label value of the application is simply ignored.

Here's my code as my question sounds quite vague:

    <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"  <!-- the app name i want it to have -->
            android:theme="@style/AppTheme" >
            <activity
                android:name="com.test.testytest.MainActivity"
                android:configChanges="orientation"
                android:label="@string/app_name" >

            </activity>

<!-- some more activities -->

            <activity
                android:name="com.test.testytest.LoginActivity"
                android:label="@string/title_activity_login" <!-- the name the app is called in the drawer etc. -->
                android:windowSoftInputMode="adjustResize|stateVisible" >
                <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            </activity>
    </application>

strings.xml:

<string name="app_name">Testy Test!</string>

strings_activity_login:

    <string name="title_activity_login">Sign in</string>

When I change the string of the Login activity to app_name, the name of the app changes, too. But I'm quite sure that the app should be called as defined in android:label in

Hope you can help me or point me to my mistake (maybe I'm just missing a little detail).

A little Edit: I don't want to change the label of my Login activity as it should remain "Login". And it also should stay the first activity to be called. But the App Name in the drawer should be the one defined in .

Answer

chrissik picture chrissik · Feb 20, 2013

Thanks to Geobits:

Here's the solution How to set different label for launcher rather than activity title?

Solution found!

Apparently the "intent-filter" can have a label attribute. If it's absent the label is inherited from the parent component (either Activity or Application). So using this, you can set a label for the launcher icon, while still having the Activity with it's own title.

http://developer.android.com/guide/topics/manifest/intent-filter-element.html

android:label="@string/title_home_activity"
android:icon="@drawable/icon">