2015-02-11 54 views
-1

我正在使用下面的代碼來選擇圖像。如何從圖庫中選取圖片而不是android中的照片?

Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); 
    photoPickerIntent.setType("image/*"); 
    photoPickerIntent.setData(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); 
    startActivityForResult(Intent.createChooser(photoPickerIntent, getActivity().getResources().getString(R.string.select_picture)), 1); 

它的工作正常,但它只讓我從默認的照片應用程序中選擇圖像。即使在當今最新的設備中,我也想從「圖庫」應用程序中選擇圖像。我不知道如何WhatsApp這樣做,即使對棒棒糖

回答

1

我使用此代碼在我的應用程序,它工作正常,我..

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

你有沒有嘗試過的棒棒糖? – 2015-02-11 07:01:59

+0

不,我在4.4.2測試... – 3rdEye 2015-02-11 07:05:48

+0

棒棒糖已取代Gallery App。這就是爲什麼我關心它... – 2015-02-11 07:09:01

相關問題