Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android App Development: Two icons getting created and I only need one

Tags:

android

icons

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

like image 423
MobiKnow Avatar asked Jan 06 '11 21:01

MobiKnow


People also ask

Why do I have 2 icons for the same app?

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.

Can you change individual app icons on 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.


Video Answer


2 Answers

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.

like image 144
WorkerThread Avatar answered Oct 01 '22 22:10

WorkerThread


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

like image 44
Cristiana Chavez Avatar answered Oct 01 '22 20:10

Cristiana Chavez