I made a simple mp3 player on Android Studio, I know how to get Artist Name and Song Title, but I don't know how to get the Album Cover Image (to set in a ImageView) This is the code that I used to get and display on a ListView the tracks with artist and title
public void getSongList() {
ContentResolver trackResolver = getContentResolver();
Uri musicUri = android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
Cursor trackCursor = trackResolver.query(musicUri, null, null, null, null);
if(trackCursor!=null && trackCursor.moveToFirst()){
//get columns
int titleColumn = trackCursor.getColumnIndex
(android.provider.MediaStore.Audio.Media.TITLE);
int artistColumn = trackCursor.getColumnIndex
(android.provider.MediaStore.Audio.Media.ARTIST);
//add songs to list
do {
String thisTitle = trackCursor.getString(titleColumn);
String thisArtist = trackCursor.getString(artistColumn);
songList.add(new Song(thisId, thisTitle, thisArtist));
}
while (trackCursor.moveToNext());
}
}