user990876
user990876

Reputation: 61

Android strange behavior while changing application name and activity label

I am facing very strange issue with android manifest file.

I have manifest something like this.....

<application android:icon="@drawable/icon" android:label="TestApplication">
    <activity android:name=".Test"  android:label="Test"  >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>

Then in that case the name of my application is "TestApplication" which should be appear on the device menu with icon. The name of launcher activity is "Test" which should be appear on the Title Bar when application launches.

But the problem is the application is showing the name "Test" as application name with icon on menu.....but it must show "TestApplication" as i have set the application name.

I am so stuck that why it is showing the launcher activity name as application name however i have specified the application name explicitly.....

Please resolve the issue

Thanks

Nikhil

Upvotes: 6

Views: 1317

Answers (2)

JerabekJakub
JerabekJakub

Reputation: 5340

<application android:icon="@drawable/icon" android:label="TestApplication">
   <activity android:name=".Test"  android:label="Test">
     <!-- See added android:label below -->
     <intent-filter android:label="TestApplication">
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
     </intent-filter>
   </activity>
</application>

If Intent does not have its own name, it will be inherited from the parent - in this case Activity. For more details look at this question.

Upvotes: 0

goto10
goto10

Reputation: 4370

This is how it is supposed to work. If you specify a label for your launch activity, that label will be displayed under the icon. If you do not specify a label, then the Application name will be used.

If you want the name next to the icon to be TestApplication then you must remove the label from the Activity. If you then want the title to be Test, you'll need to create a custom title bar.

Upvotes: 8

Related Questions