I want to have a menu item display when a user is viewing a contact in the android contact app. I thought 开发者_StackOverflow社区you had to define a intent-filter and it would show up, but it is not working like I thought it would
This is my intent-filter:
<activity android:name="com.myapp.intents.Contact" android:label="@string/actContactsMenu">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/person"
android:host="contacts" />
<data android:mimeType="vnd.android.cursor.item/contact"
android:host="com.android.contacts" />
<data android:mimeType="vnd.android.cursor.item/raw_contact"
android:host="com.android.contacts" />
</intent-filter>
</activity>
With the above, no menu displays when I am viewing a contact, but when I click on a contact in the listing, I get a popup with my activity name in it and when I choose it my activity shows up. Same goes for when I try to edit a contact.
This is not really what I want. What I want is for a menu to display when viewing a contact and editing a contact. Are intent-filters not the way to do this?
Thanks for any help.
After searching through the Android google group, it seems that this is not possible. For some reason the contacts application does not currently call the addIntenOptions method which Android uses to find any actions that can be performed on the current data. Not sure if I should be answering my own question, but I figure it might help someone else who is trying to do the same.
精彩评论