22
<activity android:name="ApiDemos">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

-Can any one explain about main, default and launcher what are the use of those properties in manifest for activity if used more than 1 activity in my project?

Dirk Jäckel
  • 2,979
  • 3
  • 29
  • 47
Sathish
  • 1,147
  • 3
  • 10
  • 20

1 Answers1

27

android.intent.action.MAIN matches all of the activities that can be used as top-level entry points into an application.

The LAUNCHER category says that this entry point should be listed in the application launcher.

The default category is required for the Context.startActivity() method to resolve your activity when its component name is not explicitly specified.

So category LAUNCHER + action MAIN let the icon for this Activity show up in the launchers list of available "applications".

You can have this intent-filter on more than one Activity in your AndroidManifest.xml and all of them will show up in the list off "applications".

Intents are documented here and IntentFilters here.

Jemshit
  • 9,501
  • 5
  • 69
  • 106
Dirk Jäckel
  • 2,979
  • 3
  • 29
  • 47
  • 1
    confused on what you mean. default is needed to be implicit. main is needed to mark it first in task. launcher is needed to make icon visible ? if no launcher means icon will never be visible in app drawer/screen so cannot be launcher by user using touch. but it can be started from other activity as such since its marked as default even if not marked main. its just that launcher needs main. so there is no independent use of main ? – Miten Oct 12 '15 at 12:39
  • reading further may be learned that explict intent does not need intent-filter. – Miten Oct 13 '15 at 07:18