Search code examples
javaandroidxmlmanifest

Activity android:label change application name


I started a new project without an activity, I then created my own and register them to manifest as below. But it seams whenever I placed a label on my LoginActivity it changes the application name.

<application
    android:name=".app.ApplicationController"
    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=".activities.LoginActivity"
        android:label="@string/login_screen_label"
        android:launchMode="singleTop"
        android:windowSoftInputMode="adjustPan">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".activities.RegisterActivity"
        android:launchMode="singleTop"
        android:windowSoftInputMode="adjustPan" />
    <activity
        android:name=".activities.MainActivity"
        android:launchMode="singleTop"/>

</application>

And my string resources

<string name="app_name">My ToDo</string>
<string name="login_screen_label">Log in</string>

What am i doing wrong

UPDATE actitity_login.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="0dp" >

</RelativeLayout>

Solution

  • Add android:label="app name" in application tag

    Using android:label in application tag will set Application name. And using android:label in Activity tag will set the title of the Activity.