android - Load album art into Glide using Listview -


  • code load album art

        if(cursor != null && cursor.movetofirst()){          int titlecolumn = cursor.getcolumnindex(mediastore.audio.media.title);         int idcolumn = cursor.getcolumnindex(mediastore.audio.media._id);         int artistcolumn = cursor.getcolumnindex(mediastore.audio.media.artist);         int albumcolumn = cursor.getcolumnindex(mediastore.audio.media.album);         long albumid = cursor.getcolumnindex(mediastore.audio.albums.album_id);          {             long thisid = cursor.getlong(idcolumn);              string thistitle = cursor.getstring(titlecolumn);             string thisartist = cursor.getstring(artistcolumn);             string thisalbum = cursor.getstring(albumcolumn);              glide.with(this)                     .load(albumid)                     .asbitmap()                     .into() //how return value?              medialist.add(new songinfo(thisid, thistitle, thisartist, thisalbum, //bitmap variable));         }         while (cursor.movetonext()); 

i'm trying load album art listview using glide. however, i'm having trouble in the;

medialist.add(new songinfo(..);

you doing wrong: use this:

medialist.add(new songinfo(thisid, thistitle, thisartist, thisalbum,albumid)); 

now, in listview adapter class, medialist , in glide method: define:

context con; 

now in constructor of adapter:

public customadapter(list<medialist> items, context context) {         medialist= items;         this.con = context;     }  glide.with(con)                     .load(medialist.getalbumid)                     .asbitmap()                     .into(imageview) 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -