I am writing an Android App that has one main activity and one subactivity. When I install the app on my phone to test it out, I get two icons instead of one. The first icon is for the main activity and the second is for the subactivity. I don't want/need an icon for the subactivity.
Does anyone know how to turn this off in my app code, so that only the icon for the main activity is installed? Any information you can provide is greatly appreciated!
Thanks, MobiKnow
If you are noticing duplicate icons for a single app repeatedly, its possible that the error stems from the app itself, rather than somewhere else. At this point, you should update the app (if there is one), and check if that resolves the duplicate icon error in Android.
To apply a new icon, use the Tap to Edit Icon button (it will also show the current app icon). You will see a list of available options for customizing the icon on the next screen. You may see custom icon packs you have installed, and you can also use text, emojis, gallery images, and system icons.
Does your application manifest list an intent filter under your sub-activity that matches the main launcher?
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
Make sure that your sub-activity is not filtering for these intents.
Edit: Just to be very clear, make sure the above lines are not listed under your sub-activity. That intent filter lets the Android system know that you intend for it to be listed as an entry point to your application.
We have the same problem but i fixed it this way before my code below in manifest
<application android:debuggable="true" android:allowBackup="true"> <activity android:name=".SplashActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.noupdate.apptest_noupdate.MainActivity" android:icon="@drawable/ic_launcher" 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>
Notice that in the SplashActivity inside the intent is this code
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
i only deleted the category
<category android:name="android.intent.category.LAUNCHER" />
So after i deleted the intent-filter category in splash it didn't install two app icon but only one for main the code will be like this notice that the intent-filter category is deleted
<application android:debuggable="true" android:allowBackup="true"> <activity android:name=".SplashActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> </intent-filter> </activity> <activity android:name="com.noupdate.apptest_noupdate.MainActivity" android:icon="@drawable/ic_launcher" android:theme="@android:style/Theme.NoTitleBar" 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>
it really helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With