2012-01-04 36 views
0

我使用下面的方法在gridview中查看圖像。 Reference使用MediaStore.Images.Thumbnails._ID顯示SD卡中的所有圖像

String[] projection = {MediaStore.Images.Thumbnails._ID}; 
Cursor cursor = managedQuery(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, projection, null, null, null); 

這表明其中有縮略圖在SD卡的圖像。 但我想顯示SD卡中的所有圖像,不僅僅是縮略圖存在。 有什麼方法可以讓Android系統爲MediaStore.Images.Thumbnails._ID創建縮略圖嗎?

回答

2

第一,URL MediaStore.Images.Media.EXTERNAL_CONTENT_URI可以返回的所有圖像, 然後MediaStore.Images.Thumbnails有方法:

public static Bitmap getThumbnail (ContentResolver cr, long origId, long groupId, int kind, BitmapFactory.Options options) 
// origid is the Images.ImageColumns._ID 
//groupid is the Images.ImageColumns.BUCKET_ID 

可以返回縮略圖。

+0

太棒了。謝謝! – Paul 2013-03-18 11:08:27

相關問題