committedandroider
committedandroider

Reputation: 9261

How does Android different between multiple components that have same action and category?

I looked up intent filters and found that they will be used when "Android finds the appropriate component to start by comparing the contents of the intent to the intent filters declared in the manifest file of other apps on the device"(http://developer.android.com/guide/components/intents-filters.html#Building)

In my manifest file, I have

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

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

which from reading that guide means that this activity can handle an implicit intent with action of main and category of launcher.

However what if i have multiple applications with the same intent filter in the manifest file. I know that some implicit intent will be called with action of main and category of launcher. How does the Android O.S know to choose this application?

Upvotes: 2

Views: 608

Answers (1)

Rajen Raiyarela
Rajen Raiyarela

Reputation: 5636

when you have multiple activities defined with same intent filter(action=main and category=launcher), then android takes the first activity defined in the hierarchy with that intent filter (action=main and category=launcher) and will launch it when user clicks on app icon.

Upvotes: 3

Related Questions