android - Glide v4 and Listview -
i have listview custom baseadapter , search toolbar filter list, every time tap on toolbar or put filter (read: every time list refreshed) there flickering due images reloading... how can avoid this?
@override public view getview(final int position, view convertview, viewgroup parent) { viewholder holder; if (convertview == null) { convertview = inflater.inflate(r.layout.listview_row, parent, false); holder = new viewholder(); holder.flag = (imageview) convertview.findviewbyid(r.id.flag); holder.name = (textview) convertview.findviewbyid(r.id.name); holder.place = (textview) convertview.findviewbyid(r.id.place); convertview.settag(holder); } else holder = (viewholder) convertview.gettag(); holder.name.settext(customlist.get(position).name); holder.place.settext(customlist.get(position).city + ", " + customlist.get(position).region + ", " + customlist.get(position).state); string url = context.getstring(r.string.main_server) + "flags/" + customlist.get(position).state.tolowercase() + ".png"; glide.with(context).load(url).into(holder.flag); return convertview; }
save images cache way not fetched again , set again every time apply filter. below code that
apply(requestoptions.diskcachestrategyof(diskcachestrategy.automatic))
note: in glide 4.0.0.
Comments
Post a Comment