How to mention two intent filters for An activity in android

ashok reddy picture ashok reddy · Dec 10, 2012 · Viewed 15.6k times · Source

I am writing an application to open HTML files so i am mentioning the intent filter for activity as

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

            <category android:name="android.intent.category.DEFAULT" />

            <data android:mimeType="text/html" />
        </intent-filter>

,for this app, no launcher icon will be there.but i want my application to be as launcher app and when i open the app i want to display some info about application,and then he open the app by html file then i want to do different functionality (parsing the html).any ideas?

Answer

gsingh2011 picture gsingh2011 · Dec 10, 2012

You can specify more than one <intent-filter> between the <activity> tags:

<activity android:name=".MyActivity">
  <intent-filter>
     <action android:name="android.intent.action.MAIN" />
     <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="text/html" />
  </intent-filter>
</activity>