J J
J J

Reputation: 165

Confusion regarding action and category

I am new to the android as a programmer.In the android manifest file we have the code as:

<activity
 android:name".Class1"
 android:label="Myapp">
 <intent-filter>
  <action android:name="android.intent.action.MAIN/>
  <category android:name="android.intent.category.LAUNCHER/>
 </intent-filter>
</activity>

Question

Why do we need to specify the category LAUNCHER, when we have specified the action to be MAIN which is enough to tell the android that Class1 is going to be initial activity of my app?

Upvotes: 0

Views: 58

Answers (2)

Dominic D&#39;Souza
Dominic D&#39;Souza

Reputation: 981

ACTION_MAIN is required Action to be performed.It is the main or starting point and wont expect any data.

CATEGORY_LAUNCHER The activity is the initial activity of a task and is listed in the system's application launcher.

You could refer these links

http://developer.android.com/reference/android/content/Intent.html What is the meaning of android.intent.action.MAIN?

Upvotes: 1

zhibin
zhibin

Reputation: 59

"android.intent.category.LAUNCHER" means this activity will display an icon in the launcher home screen. Without this category , you can't see its icon in launcher home screen.

android.intent.action.MAIN means this activity is a entry point of your app.

Upvotes: 0

Related Questions