what are the uses of main, default and launcher in manifest file in android

Sathish picture Sathish · Mar 15, 2012 · Viewed 12.3k times · Source
<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?

Answer

Dirk J&#228;ckel picture Dirk Jäckel · Jun 18, 2012

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.