안드로이드 개발 질문/답변
(글 수 45,052)
안녕하세요. 갤러리에서 Image Uri를 받아오려고 연동을 하는데 궁금한 점이 있어서 질문 좀 드릴려구요.
Intent innerIntent = new Intent(Intent.ACTION_GET_CONTENT);
innerIntent.setType(IMAGE_UNSPECIFIED);
Intent wrapperIntent = Intent.createChooser(innerIntent, null);
startActivityForResult(wrapperIntent, SELECT_GALLERY_IMAGE_ACTIVITY_REQUEST_CODE);
위 Intent를 이용해서 Gallery를 띄웠는데. Intent.createChooser(...)에 대해 궁금하더라구요.
api 설명에는
Convenience function for creating a ACTION_CHOOSER Intent.
Parameters
| target | The Intent that the user will be selecting an activity to perform. |
|---|---|
| title | Optional title that will be displayed in the chooser. |
위처럼 나와서 ACTION_CHOOSER를 가지는 Intent를 만들어 주는구나.. 라고 간단하게 이해 했습니다.
근데 처음 ACTION_GET_CONTENT는 어떻게 처리가 되는건지 궁금합니다.
그리고 위 처럼 Intent를 받으면 Gallery쪽에는 Intent-Filter가 어떻게 설정되어 있는지 보려고 Gallery의 AndroidManifest.xml을 봤는데.
...
<activity android:name="GalleryPicker" android:label="@string/gallery_picker_label"
android:configChanges="orientation|keyboardHidden"
android:icon="@drawable/ic_launcher_gallery"
android:clearTaskOnLaunch="true"
android:taskAffinity="android.task.pictures">
</activity>
<activity android:name="ImageGallery" android:label="@string/gallery_label"
android:configChanges="orientation|keyboardHidden"
android:icon="@drawable/ic_launcher_gallery">
</activity>
...
아예 Intent-Filter가 정의 안되어 있더라구요.
혹시 어떻게 처리 되는지 아시는 분 계시면 설명 좀 부탁드릴께요.




에공 죄송합니다. 첫번째 ACTION_GET_CONTENT의 처리 방법에 대해서는 sdk 설명 다시 보고 이해를 했습니다.
ACTION_CHOOSER는 System에서 matching되는 Activity가 여러개 있으면 List형식으로 유저에게 보여줄 때 사용하는 거였네요.
혹시 두번 째 질문은 아직 찾지 못했습니다. 아시는 분 계시면 알려주세요~~