Manifesto:

<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:icon="@drawable/icon1" 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=".Launcher" android:icon="@drawable/icon2" android:label="Launcher" > <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".formats.HD_Choice" > <intent-filter> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> <activity android:name=".formats.Wide_Choice" > <intent-filter> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> 

In the application I am going to make two icons, one is “Settings” (in the manifest this is MainActivity) and Launcher. The problem is that when one of the icons exits, through the HOME-button, moving to the second, the first one opens in the same state.

If you remove this combination "action.Main" + "category.Launcher", then the icon is not created.

2 answers 2

UPDATE

I found the answer. In AndroidManifest.xml for the necessary activitos add the following in intent-filter:

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

And also set lable (shortcut name) and icon (icon)

 android:icon="@drawable/ic_launcher" android:label="@string/app_Launcher" 

Example,

 <activity android:name=".activity.MainActivity" android:icon="@drawable/ic_settings" android:label="@string/app_name" android:theme="@style/AppTheme"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".activity.Launcher" android:icon="@drawable/ic_launcher" android:label="@string/labelLauncher" android:theme="@style/Theme.Transparent"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> 

    Delete <category android:name="android.intent.category.DEFAULT" /> from the last two activity .

    • No, it does not work - Akbolat SSS pm