private void buildAlbumInfo(ContentResolver cr) {
        String[] distinctBucketColumns = new String[]{Media.BUCKET_ID, Media.BUCKET_DISPLAY_NAME};
        Cursor bucketCursor = null;
        try {
            bucketCursor = cr.query(Media.EXTERNAL_CONTENT_URI, distinctBucketColumns, "0==0)" + " GROUP BY(" + Media.BUCKET_ID, null,
                    Media.DATE_MODIFIED + " desc");
            if (bucketCursor != null && bucketCursor.moveToFirst()) {
                do {
                    String buckId = bucketCursor.getString(bucketCursor.getColumnIndex(Media.BUCKET_ID));
                    String name = bucketCursor.getString(bucketCursor.getColumnIndex(Media.BUCKET_DISPLAY_NAME));
                    AlbumEntity album = buildAlbumInfo(name, buckId);
                    if (!TextUtils.isEmpty(buckId)) {
                        buildAlbumCover(cr, buckId, album);
                    }
                } while (bucketCursor.moveToNext());
            }
        } finally {
            if (bucketCursor != null) {
                bucketCursor.close();
            }
        }
    }
A task to load albums.

@author ChenSL
boxing/src/main/java/com/bilibili/boxing/model/task/impl/AlbumTask.java