In Android how to get audio files with thumbnails in to a ListView? -


in android how audio files wenter image description hereith thumbnails in list view?

here code audio storage-

public class songsmanager{ // sdcard path  private arraylist<hashmap<string, string>> songslist = new arraylist<hashmap<string, string>>(); string selection = mediastore.audio.media.is_music + " != 0"; cursor cursor; string[] projection = { mediastore.audio.media.album_id,         mediastore.audio.media.display_name, mediastore.audio.media.data,mediastore.audio.media.artist,         mediastore.audio.media.duration  };  @suppresswarnings("deprecation") public void getcursor(activity context) {      cursor = context.managedquery(             mediastore.audio.media.external_content_uri, projection,             selection, null, null);  }  public arraylist<hashmap<string, string>> getplaylist() {      while (cursor.movetonext()) {         hashmap<string, string> song = new hashmap<string, string>();         song.put("id", cursor.getstring(0));         song.put("songtitle", cursor.getstring(1));         song.put("songpath", cursor.getstring(2));         song.put("artist", cursor.getstring(3));         song.put("duration", cursor.getstring(4));         songslist.add(song);     }     // return songs list array     return songslist; } 

code audio thumb using audio id in listadapter getview method

uri sartworkuri = uri                 .parse("content://media/external/audio/albumart");         uri uri = contenturis.withappendedid(sartworkuri,                 long.parselong(songslist.get(position).get("id")));         songimage.setimageuri(uri); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -