I have an Activity that can be invoked in two ways.
<activity android:name="InstallerActivity">
<intent-filter>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/vnd.cowlark.package" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
<intent-filter>
<category
android:name="android.intent.category.SELECTED_ALTERNATIVE"/>
<action android:name="android.intent.action.DELETE" />
<data android:mimeType="vnd.android.cursor.item/vnd.cowlark.item" />
</intent-filter>
</activity>
This can be invoked either from the web browser or from a menu item.
The problem is that when I select the menu item and the Activity gets
invoked, I can't tell what action caused the invocation.
getIntent().getAction() returns null.
I think what's going on is that the Intent I'm getting when the Activity
is launched from the menu item is the template Intent I pass in to
addIntentOptions():
intent = new Intent();
intent.setType("vnd.android.cursor.item/vnd.cowlark.item");
intent.setData(ContentUris.withAppendedId(getIntent().getData(),
getSelectedItemId()));
intent.addCategory(Intent.SELECTED_ALTERNATIVE_CATEGORY);
menu.addIntentOptions(Menu.SELECTED_ALTERNATIVE, 0, new
ComponentName(this, MyListActivity.class), null, intent, 0, null);
Because it's a template, of course it doesn't have an action specified
(because otherwise it wouldn't match all my menu items!). When the
Activity receives the Intent, it hasn't had its Action set to the value
in the filter.
Any suggestions as to how I can resolve this? Other than subclassing
InstallerActivity, of course.
--
David Given
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---