Getting Album Art for music player Android -
I am quite new to Android programming. I want to know the code to return an image of the album in the album. Music Player PLS has understood what criteria I should pass, I can pass the function plz support to the path near the function! I am posting my code here with plz help!
imported essential libraries public class songsManager {// SDCard path final string MEDIA_PATH = new string ("/ sdcard /"); Private Array List & Lieutenant; Hashmap & lt; String, string & gt; & Gt; Song list = new array list & lieutenant; Hashmap & lt; String, string & gt; & Gt; (); // Constructor Public Songs Manager () {} Public Array List & Lieutenant; Hashmap & lt; String, string & gt; & Gt; GetPlayList () {File Home = New File (MEDIA_PATH); If (home.listFiles (New FileExtensionFilter ()). Length & gt; 0) {File File: home.listFiles (New FileExtensionFilter ())} {Hashmap < String, string & gt; Song = new hashmap & lt; String, string & gt; (); Song.put ("songTitle", file.getName (). Substring (0, (file.getName (). Length () - 4))); Song.put ("songpath", file.getPath ()); // Adding each song to the song lyrical song list.ed (song); }} // Return songs list list returns list songs; } Enables class fileExtensionFilter filename filter {accept public boolean (file diary, string name) {return (name.endsWith (".mp3")} name.endsWith (".mp3")); }} }
Thanks in advance,
MediaMetDataRetriever mmr = New MediaMetadataRetriever (); Mmr.setDataSource (file.getPath ()); Byte [] data = mmr.getEmbeddedPicture (); Bitmap bitmap = bitmapfender Databet more (data, 0, data lamps); ImageView.setImageBitmap (bitmap); Try the code above
Comments
Post a Comment