How can I display Album Art using MediaStore.Audio.Albums.ALBUM_ART?

Here’s how I get album art for a song:

Cursor cursor = getContentResolver().query(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, 
                new String[] {MediaStore.Audio.Albums._ID, MediaStore.Audio.Albums.ALBUM_ART}, 
                MediaStore.Audio.Albums._ID+ "=?", 
                new String[] {String.valueOf(albumId)}, 
                null);

if (cursor.moveToFirst()) {
    String path = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Albums.ALBUM_ART));
    // do whatever you need to do
}

albumId refers to MediaStore.Audio.Media.ALBUM_ID for that song.

If you’re are looking for album art for a particular song (rather than in a list of albums), as far as I know it’s a two-stage process since ALBUM_ART is a property of MediaStore.Audio.Albums and is not available directly as song metadata.

Leave a Comment