p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Android 2 Application Development (http://p2p.wrox.com/forumdisplay.php?f=547)
-   -   Confused between the rules applied to Intent and Intent Filters (http://p2p.wrox.com/showthread.php?t=78500)

fungi8210 March 9th, 2010 11:10 PM

Confused between the rules applied to Intent and Intent Filters
 
On page 145, for action tag, it says
"Each Intent Filter must have one (and only one) action tag."
From my understanding, that rule applies to Intent, not Intent Filters.
In other words, it only makes sense to fire an Intent with one (and only one) action.

For Intent Filters though, it is possible, and reasonable, to have "more than one" action tag.
Taking the notepad example, it has more than one action in one of the <intent-filter> tag for NotesList activity

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.dir/vnd.google.note" />
</intent-filter>

another example can be found in Music native application's QueryBrowserActivity
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<action android:name="android.intent.action.MEDIA_SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

Therefore, I cannot agree with the sentence "Each Intent Filter must have one (and only one) action tag."
Please correct me if I misunderstood any content.

thanks

Reto March 10th, 2010 06:48 AM

You're absolutely right. It's possible to have multiple actions defined for a single Intent Filter, it should read "Each Intent Filter must have at least one action tag".

Thanks for picking that up!


All times are GMT -4. The time now is 06:10 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.