android - Retrieve Images from Firebase into a Gridview -


whenever photo uploaded application, gridview correctly displays number of photos in firebase storage (via. baseadapter's getcount() method) , captions of images. however, when try retrieve images problem is:

the recent imageview in gridview displays first image posted , leaves previous imageviews blank. example, if had 3 imageviews in gridview , first image posted of red square, recent (3rd) imageview display red square , previous 2 imageviews blank.

here's code populates imageviews in baseadapter:

@override public view getview(final int position, view convertview, viewgroup parent) {         view v = layoutinflater.from(parent.getcontext()).inflate(r.layout.gallery_cardview, parent, false);         mcaption = (textview) v.findviewbyid(r.id.img_caption);         mimageview = (imageview) v.findviewbyid(r.id.img_posting);          storagereference ref = firebasestorage.getinstance().getreference("users/" + mainactivity.mainuser.getshopid() + "/gallery/" + keys.get(position));          ref.getdownloadurl().addonsuccesslistener(new onsuccesslistener<uri>() {             @override             public void onsuccess(uri uri) {                 //this line of code responsible loading url image                 glide.with(context).load(uri).into(mimageview);             }         }).addonfailurelistener(new onfailurelistener() {             @override             public void onfailure(@nonnull exception e) {                 log.d("upload_fail", "failure: " + keys.get(position));             }         });         mcaption.settext(picturelist.get(position));          return v;     } 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -