android - UIL, Picasso - Images in adapter always reload when stop scrolling -
i have listview text , large image internet. image item has fit width , wrap_content
height.
tried display image in background uil
& picasso
. both of them can work image reloads when stop scrolling, , makes listview flickering
looks this:
you can see it reload downloaded , cached images when stop scrolling (i scroll down , scroll up).
how can prevent happen?
<imageview android:id="@+id/imgfeed" android:layout_width="match_parent" android:layout_height="wrap_content" android:scaletype="centercrop"/> // uil options = new displayimageoptions.builder() .showimageonloading(defaultimage) .showimageonfail(defaultimage) .showimageforemptyuri(defaultimage) .resetviewbeforeloading(false) .cacheondisk(true).delaybeforeloading(0) .displayer(new fadeinbitmapdisplayer(200)).cacheinmemory(true).imagescaletype(imagescaletype.exactly_stretched).build(); imageaware imageaware = new imageviewaware(viewholder.imgfeed, false); imageloader.getinstance().displayimage(item.getphotourl(), imageaware, options); // picasso picasso.with(getcontext()) .load(item.getphotourl()) .placeholder(r.drawable.place_holder_big) .resize(screenwidth, 0) //set max width .into(viewholder.imgfeed);
for uil, tried many ways in this issue don't work me @ all.
update: seems faced memory cache issue this question. how can fix issue? @ facebook app, did well. images have different sizes fit width, , smooth scrolling without reloading images. how can that?
if you're wondering how facebook did it, released image loading library (https://github.com/facebook/fresco)
is possible calling notifydatasetchanged on underlying listview @ time? using hasstableids()?
for uil try using weakmemorycache (refer https://github.com/nostra13/android-universal-image-loader/wiki/useful-info) that'll theoretically allow make use of available memory though may cause lot of gc calls.
for picasso taha's method looks best bet!
Comments
Post a Comment