tags:

views:

86

answers:

2

I have an Android App with 2 activities. I have the following in the AndroidManifest:

<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="false">
    <activity android:name=".MyCellTracker" android:label="@string/activity1_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
 <activity android:name=".DisplaySuccess" android:label="@string/activity2_name"></activity>

The activities are properly named, yet the application is using the project name rather than the android:label (@string/app_name) I have given it. If I go to delete the application, then I see that it is named using the android:label. Why is the name that is displayed under the icon on the program launcher not using android:label in the application node?

A: 

According to that reference:

http://developer.android.com/guide/topics/manifest/activity-element.html#label

it is the label of the main activity. However if you don't set a label in the activity, the label of the application is taken.

Roflcoptr
Actually, this reference speaks about the Activity tag, not the Application tag. and it seems taht the label is not used the same way. But yes for an unknown reason, the application takes the label of the main activity...
Sephy
I read that link. So, in essence, the name of the application on the program launcher can't be different than the main activity label? That's what it seems to indicate, it just doesn't make sense to me.
nickfox
@Sephy: yes but there are also other links that explain the label of the application. And both information together seem to show that its the main activity.
Roflcoptr
+1  A: 

This may not be the answer you're looking for, but you can set the activity title using setTitle(string title).

Set the title programmatically, and set the app title in the manifest using the main activity's label.

Michael Pardo
Yes, that did work, thanks. I still think that the android:label in the application node should be the name of the application on the launcher. Just my way of thinking...
nickfox
I'm loosing track of the logic of the question. nickfox asks about application name, and then accepts an answer about activities...
Sephy
Sephy, I set the android:label in the application node and in the main activity node to @string/app_name. This is the name that is displayed on the program launcher. I used setTitle(string title) in the main activity's onCreate method to reset the label in the main activity thus allowing my main activity to have a different label than the program launcher.
nickfox
Sorry didn't realize that was your question when I saw "how to name Android Application"... ok then. good luck
Sephy