以下功能得到畫廊
private ArrayList<String> getAllShownImagesPath(Activity activity) {
Uri uri;
Cursor cursor;
int column_index_data, column_index_folder_name;
ArrayList<String> listOfAllImages = new ArrayList<String>();
String absolutePathOfImage = null;
uri = android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
String[] projection = { MediaColumns.DATA,
MediaStore.Images.Media.BUCKET_DISPLAY_NAME };
cursor = activity.getContentResolver().query(uri, projection, null,
null, null);
column_index_data = cursor.getColumnIndexOrThrow(MediaColumns.DATA);
column_index_folder_name = cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.BUCKET_DISPLAY_NAME);
while (cursor.moveToNext()) {
absolutePathOfImage = cursor.getString(column_index_data);
listOfAllImages.add(absolutePathOfImage);
}
return listOfAllImages;
}
類似的所有圖像列表...? http://stackoverflow.com/questions/11144783/how-to-access-an-image-from-the-phones-photo-gallery – Santosh
你需要[閱讀圖片](http://stackoverflow.com/questions/ 17674634/save-and-reading-bitmaps-images-from-internal-memory-in-android)並將它們添加到您的自定義適配器 –
我明白了,我將讀取另一個線程並閱讀圖像(我必須學習很多)謝謝你們 – JRebo