Mandroid Mandroid - 22 days ago 6
Android Question

How to make app appear as an option application?

What needs to be done to make your app appear as an option app.
For eg, when I select an image file, android shows me a list of applications to open the file with, like Gallery,Photos etc.
I want that android also shows my app in this list.

How to achieve this? I am unable to understand which android classes to use for it? Or do I need to modify manifest file to add some specific intents?

Answer

By defining intent filter you can achieve this. You can register your Android components via intent filters for certain events.If a component does not define one, it can only be called by explicit intents. The key for this registration is that your component registers for the correct action, mime-type and specifies the correct meta-data.

Eg.

<activity android:name=".BrowserActivitiy"
      android:label="@string/app_name">
<intent-filter>
 <action android:name="android.intent.action.VIEW" />
 <category android:name="android.intent.category.DEFAULT" />
 <data android:scheme="http"/>
</intent-filter>
</activity>

Above code will register an Activity for the Intent which is triggered when someone wants to open a webpage.

Source: http://www.vogella.com/tutorials/AndroidIntent/article.html