1

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>
asmgx
  • 7,328
  • 15
  • 82
  • 143

2 Answers2

2

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.

Community
  • 1
  • 1
joao2fast4u
  • 6,868
  • 5
  • 28
  • 42
0

change @string/title_activity_login to "MyApp"

Zallen
  • 126
  • 6