2011-12-27 10 views
0

ので、私は、docからインテントフィルタの段落を読んでいたが、私たちはメモ帳のプロジェクトから、この例のように、インテントフィルタを分離し、なぜ私は本当に理解することはできません。android intent filter:なぜそれらを分けるのですか?

<activity android:name="NoteEditor" 
        android:theme="@android:style/Theme.Light" 
        android:label="@string/title_note" > 
      <intent-filter android:label="@string/resolve_edit"> 
       <action android:name="android.intent.action.VIEW" /> 
       <action android:name="android.intent.action.EDIT" /> 
       <action android:name="com.android.notepad.action.EDIT_NOTE" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
       <data android:mimeType="vnd.android.cursor.item/vnd.google.note" /> 
      </intent-filter> 
      <intent-filter> 
       <action android:name="android.intent.action.INSERT" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
       <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" /> 
      </intent-filter> 
</activity> 

ので、我々は唯一の受け入れVIEW、EDIT、EDIT_NOTEのいずれかのアクションが必要ですか? このフィルタを閉じてINSERTアクション用に新しいフィルタを開くのはなぜですか?

おかげ

答えて

1

は、我々はintent-filterを閉じてINSERTのための新しいものを追加し、他のactions以外のデータを必要とするINSERTためにする必要があります。 mimeTypesdata

+0

ありがとう;-)それは意味がありますし、私はあなたのタイプが "dir"の "メモ"の例を教えてくれますか?これらの2つのデータの違いは何ですか? – Paul

+0

これを読んで、答えを得てください:http://developer.android.com/guide/topics/intents/intents-filters.html "[...]インテントには、MIMEタイプに一致するデータのURIが含まれていますvnd.android.cursor.dir/vnd.google.note - つまり、メモを配置するディレクトリのURIです。 " – Sprigg

+0

ありがとうSprigg – Paul

関連する問題