I'm trying to get my main activity to be the launcher activity and also receive send events. Somehow I can't seem to make both work same time. Either I have the launcher icon in the app tray but then not in image share menu in from gallery for example. How can I make both work at the same time.
With this intent filter the icon is in app tray but not in share menu.
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.SEND" />
</intent-filter>
With this one I have it in the share but not in app tray
<intent-filter>
<category android:name="android.intent.ca开发者_开发百科tegory.LAUNCHER"/>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="image/*" />
</intent-filter>
I suspect it has something to do with the data element and I tried this but it didn't work
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="image/*">
</action>
</intent-filter>
Any help much appreciated, thank you!
I found the solution. You can actually have more than one intent-filter tag in an action. So the right code was
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<data android:mimeType="image/*"/>
</intent-filter>
精彩评论