Android strange behavior when changing application name and activity shortcut

I have a very strange problem with an Android manifest file.

I have 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 this case the name of my application will be "TestApplication", which should appear in the device menu with an icon. The name of the launch activity is “Test”, which should appear in the title bar when the application starts.

But the problem is that the application shows the name “Test” as the name of the application with an icon in the menu ..... but it should show “TestApplication” since I set the name of the application.

I am so stuck that it shows the name of the launch activity as the name of the application, but I explicitly specified the name of the application .....

Please fix the problem.

thanks

Nihil

+6
source share
2 answers

This is how it should work. If you specify a label for your launch activity, that label will appear below the icon. If you do not specify a label, the application name will be used.

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

+8
source
 <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 the Intent does not have a proper name, it will be inherited from the parent - in this case, Activity. See this question for more details.

0
source

Source: https://habr.com/ru/post/899388/


All Articles