Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 520
Sathish Avatar asked Mar 15 '12 13:03

Sathish


People also ask

What is main and launcher tag in Android manifest file?

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.

What is the main purpose of the Android manifest file?

The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

What will happen if we declare multiple launcher in manifest file?

On latest Android versions - If there are more than one launcher activities and if we don't put this category tag then the activity which is mentioned first in the Android manifest file will get launched as start-up activity.

What are manifest files used for?

A MANIFEST file is an XML document that describes the manifest, or package contents, of a Windows software application. It is used by various Windows technologies for configuring and deploying software, including ClickOnce and the Common Language Runtime (CLR). MANIFEST files are often seen with the compound ".exe.


1 Answers

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.

like image 171
Dirk Jäckel Avatar answered Oct 01 '22 12:10

Dirk Jäckel