Android: Why is the name of the android application accepted as the name of the initial action?

In my manifest file, I gave the application name as MyApp and the name of the initial action as the main menu.

<application android:theme="@style/theme" android:icon="@drawable/myicon" android:label="@string/app_name">
    <activity android:name=".MainMenu"
              android:label="@string/mainmenu_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

When I see the application icon on the default menu screen for Android, the name indicated is the Main menu. Why is MyApp not the name displayed for the application?

+3
source share
3 answers

If android:labelset to activity, then its value is taken. It is omitted for activity, then instead of the attribute android:labelset to application.

, , . , , .

+1

, . , :

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

, . , , , .


, android:icon (, , <application> ). , .


"" , . , (, ) ACTION_SEND (, - . Facebook, Twitter,...), , "" , , , ( Facebook, Twitter ). (.. Facebook logo Facebook). android:icon android:label, <activity>, , <application>.

​​, " MyApp", . , , ACTION_VIEW, , , " MyApp".


, <intent-filter> . , Android :

  • <intent-filter>, , .
  • <activity>, , .
  • <application>.

:

  • / : , , ( , " MyApp" )
  • . , ACTION_SEND, ACTION_VIEW . "Share via MyApp" "View in MyApp".

, , , , Android / .


, , - , , ( ). , ( ).

+10

In the manifest, remove the attribute android:labelat startup. Then the action inherits the name specified in the application android:label.

+1
source

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


All Articles