android - Listview flickering on notifyDataSetChanged() when using universal image loader -
i facing same issue mentioned in link given below:
https://github.com/nostra13/android-universal-image-loader/issues/376
i have checked solutions in above link , seems given below solution solving problem:
imageaware imageaware = new imageviewaware(imageview, false); imageloader.displayimage(imageuri, imageaware);
but same flickering issue happen, if pass options displayimage
() method in above code. means, below code causing issue:
imageaware imageaware = new imageviewaware(imageview, false); imageloader.displayimage(imageuri, imageaware,options);
how can stop flickering issue when when passing 'options' displayimage()
method?
here option passing method:
options = new displayimageoptions.builder().showimageforemptyuri(r.drawable.empty).showimageonloading(r.drawable,loading).showimageonfail(r.drawable.failed).cacheondisc(true).bitmapconfig(bitmap.config.rgb_565).imagescaletype(imagescaletype.in_sample_int).build();
the solution not reload image when did not change.
in adapters getview() do:
// schedule rendering: final string path = ... (set path here); if (holder.lastimageurl == null || !holder.lastimageurl.equals(path) || holder.headerimageview.getdrawable() == null) { // refresh image imageloader.displayimage(imageuri, imageaware); } else { // nothing, image did not change , not need updated }
on success (add imageloadinglistener) set holder.lastimageurl = path, on fail , cancel set holder.lastimageurl null reload next time.
Comments
Post a Comment