Android Application Name Appears as Activity Name

The above accepted answer is wrong. It says,

the name comes from the android:label attribute on the application tag

That's not true. Take the following code for example.

<activity android:name="ApiDemos" android:label="@string/app_name">
     <intent-filter>
         <action android:name="android.intent.action.MAIN" />
         <category android:name="android.intent.category.DEFAULT" />
         <category android:name="android.intent.category.LAUNCHER" />
     </intent-filter>
</activity>

In this code, the app name that shows in the launcher is set by the android:label attribute in the activity tag not the application tag as the above accepted answer says.

To correct the above accepted response, the name shown under the icon in the launcher comes from the android:label attribute in the entry point activity's activity tag (the activity tag that contains the DEFAULT and LAUNCHER categories) unless you don't specify it there in which case it comes from the android:label attribute on the application tag.

Your first issue can be solved by changing the android:label attribute in your entry point activity's tag.


For the first issue, you should be aware that in absence of a label on the launching Activity the name comes from the default label set in the android:label attribute on the application tag:

<application android:name="ApiDemosApplication"
   android:label="@string/activity_sample_code"
   android:icon="@drawable/app_sample_code">

If the Activity has a label, that label will be used instead.

For the second issue, in the manifest, it is likely that all your activities specify an intent filter with an action of android.intent.category.LAUNCHER. For example:

<activity android:name="ApiDemos">
     <intent-filter>
         <action android:name="android.intent.action.MAIN" />
         <category android:name="android.intent.category.DEFAULT" />
         <category android:name="android.intent.category.LAUNCHER" />
     </intent-filter>
</activity>

If you have such intent-filter tags on all activities, you should take out the intent filter tags on all but the Activity that you want to launch at startup. If this Activity has a label, it is the label that will be shown along with the launcher icon.

As of 2019/01/03 on API 27+, it appears that the first activity with the LAUNCHER category will be launched and its label will be associated with the app icon, so it may not be strictly necessary to remove all the redundant intent filters, but I'd do it anyway because it can lead to confusion.

Tags:

Android