Use MediaStore
to get all of the device images getting through file iteration is very slow. You can get them like this:
Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
String[] projection = { MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA,
MediaStore.Images.Media.BUCKET_ID };
String selection = MediaStore.Images.Media.BUCKET_ID + " = " + mAlbumId; //to get from specified folder
Cursor cursor = getContentResolver().query(uri, projection, selection, null, null);
while (cursor.moveToNext()) {
Picture picture = new Picture();
int columnIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATA);
picture.path = cursor.getString(columnIndex);
columnIndex = cursor.getColumnIndex(MediaStore.Images.Media._ID);
picture.id = cursor.getLong(columnIndex);
columnIndex = cursor.getColumnIndex(MediaStore.Images.Media.BUCKET_ID);
picture.bucketId = cursor.getString(columnIndex);
mAvailableImages.add(picture);
}
cursor.close();
Then use retrieved data in ListView with custom adapter and write your own ImageManager which will create and manage bitmaps for you.
You can read this and this topics.
Also look at Android native gallery http://viralpatel.net/blogs/pick-image-from-galary-android-app/