2014-09-19 3 views
1

갤러리에서 이미지를 선택하고 싶지만 갤러리에만 이미지를 표시하고 싶습니다. 나는 이런 내 의도를 만들 수 있지만 난 여전히 일부 장치Gallery only images

Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); 
    intent.setType("image/*"); 

편집에 동영상을 볼 :이 같은 의도를 구축 킷캣 장치에 대한

.

 Intent intent = new Intent(Intent.ACTION_GET_CONTENT); 
    intent.setType("image/*"); 
+0

이 링크는 – AdrianoCelentano

답변

0
please try this one  

if (Build.VERSION.SDK_INT < 19) 
{ 
Intent intent = new Intent(); 
intent.setType("image/jpeg"); 
intent.setAction(Intent.ACTION_GET_CONTENT); 
startActivityForResult(DialogsFragment.this, 
Intent.createChooser(intent, "Select Picture"), GALLERY_INTENT_CALLED); 
} 
else 
{ 
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(DialogsFragment.this, intent,GALLERY_KITKAT_INTENT_CALLED); 
} 
+0

이 실제로 내가 할 동일로 파일에서로드 비트 맵에 관한 것입니다 조건 버전을 현명하게 넣기 – AdrianoCelentano

+0

가해야하는 MIME 타입을 설정하지 않고있는 gridview – Jatin

+0

if (Build.VERSION.SDK_INT <19) { \t \t \t \t \t \t 인 텐트 intent = 새 인 텐트(); \t \t \t \t \t \t intent.setType ("image/jpeg"); \t \t \t \t \t \t intent.setAction (Intent.ACTION_GET_CONTENT); \t \t \t \t \t \t에 startActivityForResult ( \t \t \t \t \t \t \t \t DialogsFragment.this, \t \t \t \t \t \t \t \t Intent.createChooser (의도) "사진 선택" \t \t \t \t \t \t \t \t GALLERY_INTENT_CALLED); \t \t \t \t \t} 다른 { \t \t \t \t \t \t \t \t \t \t \t 의도 의도 = 새로운 의도 ( \t \t \t \t \t \t \t \t Intent.ACTION_PICK, \t \t \t \t \t \t \t \t android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); \t \t \t \t \t \t에 startActivityForResult ( \t \t \t \t \t \t \t \t DialogsFragment.this, 의도 \t \t \t \t \t \t \t \t GALLERY_KITKAT_INTENT_CALLED); \t \t \t \t \t – Jatin

0

이 시도 :

Intent intent = new Intent(); 
intent.setType("image/*"); 
intent.setAction(Intent.ACTION_GET_CONTENT); 
startActivityForResult(Intent.createChooser(intent, "Select_Picture"), PICK_IMAGE); 
+0

내 코드는 – AdrianoCelentano

+0

과 같지만 두 가지 옵션이 있습니다. 첫 번째 옵션을 시도 했습니까? –

+0

나는 propably 그것을 보지 못했지만, 당신의 awnser pls을 편집 할 수 있습니까? – AdrianoCelentano

0
Add conditions based on OS version 

Try this  

if (Build.VERSION.SDK_INT < 19) { 
       Intent intent = new Intent(); 
       intent.setType("image/jpeg"); 
       intent.setAction(Intent.ACTION_GET_CONTENT); 
       startActivityForResult(DialogsFragment.this, 
         Intent.createChooser(intent, "Select Picture"), 
         GALLERY_INTENT_CALLED); 
      } else { 
       Intent intent = new Intent(
         Intent.ACTION_PICK, 
         android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); 
       startActivityForResult(DialogsFragment.this, intent, 
         GALLERY_KITKAT_INTENT_CALLED); 
      } 
+0

내 코드와 다른 점은 무엇입니까? – AdrianoCelentano

+0

왜이 질문에 2 개의 다른 대답이 있습니까? – 2Dee