I've been developing an android music player and I would like to load the cover image which each mp3 tag has. I previously used the following code to extract the image but, when the list view is starts scrolling it gives a lot of errors and the app crashes at random times. The code is as following.
MediaMetadataRetriever retrieve = new MediaMetadataRetriever();
retrieve.setDataSource(songsList.get(songIndex).get("songPath"));
byte [] data = mmr.getEmbeddedPicture();
This throws an error saying the following message and at random points the application crashes.
getEmbeddedPicture: Call to getEmbeddedPicture failed
So I used the glide library to load the images using the following code.
Glide.with(parent.getContext()).load(currSong.getPath())
.placeholder(R.drawable.default_img).into(holder.albumImage);
The thing is I pass the song path to the load function but doesn't load any image to it! I logged the path and it shows the correct path to the mp3 file.
How can I load the images using the Glide library! If there is a tutorial on this, please be kind enough to let me know.