본문 바로가기
프로그래밍 놀이터/안드로이드, Java

[Android/안드로이드] IntentFilter 고급정보.

by 돼지왕 왕돼지 2012. 5. 23.
반응형




http://developer.android.com/guide/topics/intents/intents-filters.html 

- Intent 의 setData() 에는 target component 에서 다룰 URI 를 넣어주고, setType() 에는 MIME type 을 넣어준다. setDataAndType() 을 통해 2개를 한번에 설정해줄 수도 있다.
 

- IntentFilter matching 시에 action, data ( both URI and data type ), category 이렇게 3개를 비교한다.


- startActivity() 는 명시해주지 않는한 최소한 android.intent.category.DEFAULT 를 가지고 있다. 그래서, implicit intent 를 받고싶은 component는 반드시 DEFAULT category 를 filter 에 걸어주어야 한다. ( android.intent.ation.MAIN & android.intent.category.LAUNCHER 조합은 예외다. )


- Intent-filter 의 <data> tag 는 URI 와 data type 을 명시한다. URI는 scheme, host, port 그리고 path 로 구성된다. data type 은 MIME type 을 명시.

- Intent 에 URI 와 Data 둘 다 설정이 되어 있다면, 둘 다 matching 이 되거나, Data는 matching 되고, URI 는 content: 혹은 file: 일 때 pass 된다.


- PackageManager 의 query...() 는 해당 intent 를 받아들이는 component 들을 보여주며, resolve...() 는 해당 intent 를 받아들이기 좋은 best component 를 보여준다. 


- ACTION_NAME_PICK 의 data mimeType 은 해당 activity 가 보여줄 data 내용이라면, ACTION_NAME_GET_CONTENT 는 해당 activity 가 return 해줄 data 내용.
 

- android.intent.category.ALTERNATIVE 와 android.intent.category.SELECTED_ALTERNATIVE 는 자신을 해당 intent 를 처리할 능력이 있는 녀석이라고 등록하는 녀석이다. 이 category 를 명시한 녀석들은 label 을 붙여주어야 한다. 그 label 이 option menu 의 item label 이 된다. 이렇게 category 를 지어놓으면, Option Menu에서 Menu.addIntentOptions() 를 통해 Intent 를 처리할 수 있는 녀석을 Menu 에 등록시킬 수 있다.

( 참조 : http://androidhuman.tistory.com/265 )


도움이 되셨다면 손가락 꾸욱~




반응형

댓글