java - How to get ArrayList<String> image URLs into ImageView of ListView getView method -
@override public view getview(int position, view convertview, viewgroup parent) { if(convertview == null){ convertview = inflater.inflate(resource, null); } imageview imageview; imageview = (imageview) convertview.findviewbyid(r.id.ivgallery); for(hospitalmodel.images images: hospitalmodellist.get(position).getimageslist()) { glide.with(getcontext()).load(images).into(imageview); } return convertview; }
// image urls stored in string arraylist
. defined getter , setter array list still don't know how use method showing arraylist
images dynamically in listview
extend class baseadapter
override getcount() method , return here total amount of images need show.
in getview load glide 1 url (remove loop), getview method called n times show in list "total" amount of images returned in getcount method, position parameter in getview method run 0 (total - 1).
you should map 1 position 1 url, maybe need change way access objects contain urls.
Comments
Post a Comment