user2684198
user2684198

Reputation: 852

How to correctly set the name of the application?

This is my Manifest file.

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" 
            android:windowSoftInputMode="adjustNothing" >
        </activity>
        <activity
            android:name=".StartScreen"
            android:label="@string/title_activity_start_screen" >
                <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Tutorial"
            android:label="@string/title_activity_tutorial" >
        </activity>
        <activity
            android:name=".HomeScreen"
            android:label="@string/title_activity_home_screen" >
        </activity>
        <activity
            android:name=".SignIn"
            android:label="@string/title_activity_sign_in" >
        </activity>
    </application>

When I am installing the application, I correctly see the name of the application as set in strings.xml file for "app_name". However, it prints the name for "activity_title_start_screen" in my apps tab (Edit: the screen where we see all the applications in the phone). How to solve this?

Upvotes: 1

Views: 189

Answers (3)

Secko
Secko

Reputation: 7716

Change your label in <application:

android:label="@string/app_name"

You have to change the string.xml file. In string.xml look for a line such as this:

<string name="app_name">CustomAppName</string>

Change the content CustomAppName to a desired name.

Then if you wish your app activity title to be different change the label in <activity, by finding it in strings.xml file and changing it to a desired name.

android:label="@string/title_activity_start_screen" >

Another way would be to use a method called setTitle and putting this line in your onCreatemethod in your activity.

setTitle("My App Title");

Upvotes: 1

user901309
user901309

Reputation:

Remove:

android:label="@string/title_activity_main" 

From your Activity declarations and set the title programmatically in code:

mActionBar.setTitle(getString(R.string.title_activity_main));

Upvotes: 0

DanielVorph
DanielVorph

Reputation: 131

Modify

android:label="@string/title_activity_main" 

Put

android:label="@string/app_name"

Upvotes: 0

Related Questions