Andres
Andres

Reputation: 4501

Installing Android app in a device

I'm a newbie programming for android, I made a simple game some days ago and I tried to install it in a tablet(Android 4.0).

The program works ok, but I got four(4) icons of my app after installation and only one of them is correct(third).

I just want to know how I can to solve this bug so that when I install it in another device it runs ok and get only one icon.

Thanks in advance.

Upvotes: 0

Views: 113

Answers (2)

knennigtri
knennigtri

Reputation: 307

It's because in your manifest you need to change all of your activities EXCEPT your first activity (usually your mainActivity) from:

<activity
            android:name=".SecondActivity"
            android:label="activity name" >
            <intent-filter
                android:label="Your App Name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity> 

to:

<activity
            android:name=".SecondActivity"
            android:label="activity name" >
        </activity> 

Basically just take the intent-filter out of all your activities that are NOT your main activity. Your main activity needs it so that there is a launcher icon. Hope that helps.

Upvotes: 1

ρяσѕρєя K
ρяσѕρєя K

Reputation: 132992

I got four(4) icons of my app after installation

means you have declared more then one Activity in AndroidManifest.xml as launch Activity. to show only one Activity as launcher you will need to declare only one Activity with android.intent.action.MAIN and android.intent.category.LAUNCHER intent-filter. Declare Main Activity which u want to show in Launcher as:

<activity android:name="MainActvity"
          android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

and other 3 Activity declare as in AndroidManifest.xml as :

<activity android:name="Actvity_Two"
              android:label="@string/app_name" />
<activity android:name="Actvity_Three"
              android:label="@string/app_name" />
//declare other in same way ..

Upvotes: 0

Related Questions