Why does the menu button in the emulator show all the actions of my application?

I just want it to show only one action in the main menu and hide the rest.

My manifest file looks something like this.

  

<application android:icon="@drawable/icon" android:label="@string/app_name"
    android:debuggable="true">
    <activity android:name=".MainAct" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".StartGame" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Instructions" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".About" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

+3
source share
2 answers

You do not need to repeat these lines for all actions;

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

For basic only

(as an ad to your question:

From: http://developer.android.com/guide/topics/manifest/manifest-intro.html

, , . , "android.intent.action.MAIN" "Android.intent.category.LAUNCHER" - , , . , , , .

+6

, , 2 . , MAIN LAUNCHER.

+1

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


All Articles