In my application I have a number of Activity classes. When I run on emulator (or install to a device) a corresponding number of program shortcuts show up in the programs menu. Why does this happen and how can I avoid it? Many thanks.
A:
I think you need to look in your manifest file. I believe that is where the intents are defined.
David Radcliffe
2010-07-07 11:19:40
Ah - I think I see - so I should use android.intent.category.LAUNCHER only for the activity that comprises the main entry point to the application; and some other category for the other activities?
AlanH
2010-07-07 11:28:20
Yes - that is exactly what I was thinking. (I don't have my code in front of me)
David Radcliffe
2010-07-07 11:29:53
Many thanks - that points me in the right direction at least.
AlanH
2010-07-07 11:50:34
+2
A:
I think you have added LAUNCHER attribute in every activity...so multiple shortcuts showing up in your program menu.
But,
There should(mostly) only one "LAUNCHER" activity....
Do like Following:
<activity android:name=".Testing"
android:label="Showing Testing">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activity1"
android:label="@string/Activity1">
</activity>
<activity android:name=".Activity2"
android:label="@string/Activity2">
</activity>
<activity android:name=".Activity3"
android:label="@string/Activity3">
</activity>
</application>
PM - Paresh Mayani
2010-07-07 13:42:05
Thank you Paresh - yes, I had figured this from David's answer. I have now changed so that there is only one "LAUNCHER". The other activities I have set the intent-filter to:<action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" />This works for me, but I don't know whether this is the most suitable setting and I need to read up on this aspect of Android development.
AlanH
2010-07-07 16:20:39