In the Android manifest file, what do you mean by the category Launcher and action MAIN
category android:name="android.intent.category.LAUNCHER"
action android:name="android.intent.action.MAIN"
Is it possible to make one activity the laucher and another one the main action?
2 Answers
Activities will very often need to support the CATEGORY_DEFAULT
so that they can be found by Context.startActivity()
. So, CATEGORY_DEFAULT
can appear number of times.
Android does not grab whichever one appears first in the manifest but it starts with activity having CATEGORY_LAUNCHER
.
CATEGORY_LAUNCHER
: The activity can be the initial activity of a task and is listed in the top-level application launcher.
For more details refer: http://developer.android.com/guide/topics/intents/intents-filters.html
Extending the answer of Balaji, I'll add-up a few things:
For the starters, there could be multiple points of entry to an app. Let's suppose our app has two activities for simplicity.
You can keep the <intent-filter>
tag in both activities and contain MAIN
as well as LAUNCHER
into it. This would create two launchers of the app - and two identical app icons could be physically seen at your app-launcher. You click on one icon - and it'll start one of the activities. You click the other, and it'll start the other activity.
However, if you drop either of MAIN
or LAUNCHER
tag from the the second activity, there'll be only one physical launcher for the app which launches the first activity.
Having said that,
MAIN
in an activity is used to tell that when the app starts, it'll start with this very activity.