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

Exception or error:
<activity android:name="ApiDemos">
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.LAUNCHER" />

-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?

How to solve:

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.

Leave a Reply

Your email address will not be published. Required fields are marked *