Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple android.intent.action.MAIN in manifest xml file

Tags:

android

I am new to Android development I seen lots of tutorial where they have only android.intent.action.MAIN which is basically a start activity of the application.

But, in the android app demos, I have seen multiple android.intent.action.MAIN statements in mainfest.xml. Can anyone explain why the mainfest.xml has multiple android.intent.action.MAIN statements?

And, in which scenarios we are supposed to have multiple MAINs in manifest.xml?

like image 717
user1043831 Avatar asked Nov 13 '11 04:11

user1043831


1 Answers

They're different entry points into the program. For instance, I just created two activities, both of which had the typical intent filter

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

It turns out that my launcher screen now has two different icons for the same program, one for each different activity. This makes sense, since the MAIN/LAUNCHER intent filter essentially tells android that the activity is the app's starting activity. Nothing in android's intent filter model forces each app to have one and only one starting activity.

like image 66
aleph_null Avatar answered Oct 26 '22 22:10

aleph_null