I have a list of albums which I got using this:
private List<Album> getAlbums() {
Cursor cur = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null, null, null);
List<Album> albums = new ArrayList<Album>();
if (cur.moveToFirst()) {
do {
int albumIdIndex = cur.getColumnIndex(MediaStore.Audio.Media.ALBUM_ID);
int albumIndex = cur.getColumnIndex(MediaStore.Audio.Media.ALBUM);
int artistIndex = cur.getColumnIndex(MediaStore.Audio.Media.ARTIST);
int albumId = cur.getInt(albumIdIndex);
String name = cur.getString(albumIndex);
String artist = cur.getString(artistIndex);
LogUtil.i(TAG, "albumid= " + albumId + ", album= " + name + ", artist=" + artist);
Album album = new Album(albumId, name, artist);
if (!albums.contains(album)) {
albums.add(album);
}
} while (cur.moveToNext());
}
return albums;
}
I use this list of albums in a ListActivity, but I also want to get the thumbnails of the Albums.
I know I can use the following code to get the actual artwork, but I need the thumbnails because I get Out Of Memory if I use the full images in a List Activity:
Uri sArtworkUri = Uri.parse("content://media/external/audio/albumart");
Uri uri = ContentUris.withAppendedId(sArtworkUri, album_id);
I saw this post: http://stackoverflow.com/questions/2902232/android-media-thumbnails-serious-issues But I do not have the imageId, only the albumid, so I don't think it helps.