I am creating a Media player app which gets the songs and their data from the users phone add them in an ArrayList. Im reading the data through cursors and im kinda stuck at the Album Art. The code im using below does not crash the app and even if the mp3s stored in my device have album art i cannot get em. COuld use some help
Cursor imgCursor = 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(MediaStore.Audio.Albums._ID)},
null);
do{
if (imgCursor.moveToFirst()) {
String imgPath = imgCursor.getString(imgCursor.getColumnIndex(MediaStore.Audio.Albums.ALBUM_ART));
Log.v("Musiclistactivity", "img path is" + imgPath);
currentImage = BitmapFactory.decodeFile(imgPath);
} else {
currentImage = BitmapFactory.decodeResource(getResources(), R.drawable.nocover);
}}while (imgCursor.moveToNext()) ;