View Single Post
  #1 (permalink)  
Old March 9th, 2010, 11:10 PM
fungi8210 fungi8210 is offline
Registered User
 
Join Date: Mar 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

Last edited by fungi8210; March 9th, 2010 at 11:13 PM..
Reply With Quote