asmgx
asmgx

Reputation: 8054

Android: App name shows the first page name, not the app name

I changed the initial page in my app to be the "login" activity but now I get the app name in my mobile called "login"

I checked @string/app_name it show "MyApp" yet the app name still "login" in my mobile

is there anyway to change the app name to "MyApp" without changing the login activity title?

here is my AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.asmgx.myapp.app" >

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application
        android:name="com.asmgx.myapp.app.PubVar"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:debuggable="false">
        <activity
            android:name="com.asmgx.myapp.app.MainActivity"
            android:label="@string/app_name" >

        </activity>
        <activity
            android:name="com.asmgx.myapp.app.add_msg"
            android:label="@string/title_activity_add_msg" >
        </activity>
        <activity
            android:name="com.asmgx.myapp.app.ItemDetail"
            android:label="@string/title_activity_item_detail" >
        </activity>
        <activity
            android:name="com.asmgx.myapp.app.ListFilter"
            android:label="@string/title_activity_list_filter" >
        </activity>
        <activity
            android:name="com.asmgx.myapp.app.login"
            android:label="@string/title_activity_login" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.asmgx.myapp.app.test1"
            android:label="@string/title_activity_test1" >
        </activity>
    </application>

</manifest>

Upvotes: 1

Views: 1526

Answers (2)

Zallen
Zallen

Reputation: 126

change @string/title_activity_login to "MyApp"

Upvotes: 0

joao2fast4u
joao2fast4u

Reputation: 6892

If your Launcher Activity does not have a label in its intent-filter attribute, its label value will be inherited from the parent component (either Activity or Application).

So you just have to add a label on your intent-filter, like this:

<activity
        android:name="com.asmgx.myapp.app.login"
        android:label="@string/title_activity_login" >
        <intent-filter android:label="@string/app_name">
            <action android:name="android.intent.action.MAIN" />

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

This will apply your App name the @string/app_name value and give the Activity title the @string/title_activity_login value.

See the accepted answer from this post for more info.

Upvotes: 2

Related Questions