android - Listview lags even when images are cached using Picasso -


i have list view contains images , when scroll after point, scrolling lags.

i using picasso , following code make sure images loaded memory in background thread.

    picasso         .load(f)         .fit()         .error(r.drawable.broken_image)         .into(viewholder.imageview, loaddonecallback); 

if listview entries loading same image, there no lag, seems issue related loading image memory viewholder.imageview.

another data point seeing lag on o+o device running android 4.4.4. however, nexus 5, running android 5.1 doesn't seem have issue. both seem using heap size of around 128mb+. @ ~40kb per thumb , 3 thumbs per row, , total of 50 rows (i see lag when go past first 10 rows), total image size in memory should ~6mb , images should fit in cache (even though loading anyways done in background thread).

when recreated issue multiple times scrolling , down, managed skipped x frames message.

06-03 22:24:30.279    2382-2382/xxx i/choreographer﹕ skipped 58 frames!  application may doing work on main thread. 

again, assuming work happening in main thread related individual images loaded picasso cache imageview. assuming can't related other layout related calculations etc, since using same image listview entries works perfectly.

is expected or making rookie mistake?

update: getview code

@override public view getview(final int position, view convertview, viewgroup parent) {     view view;     viewholder viewholder = new viewholder();     final string imageid = getitem(position);     if (convertview == null) {         view = inflator.inflate(r.layout.image_row_home, parent, false);         viewholder.imageview = (imageview) view.findviewbyid(r.id.img);         viewholder.imageview.getlayoutparams().height = imagewidth;         viewholder.imageview.getlayoutparams().width = imagewidth;         viewholder.imageview.setscaletype(imageview.scaletype.center_crop);         viewholder.imageid = imageid;         view.settag(viewholder);     } else {         view = convertview;         viewholder = ((viewholder) view.gettag());         // if view image want, no need recreate it.         if (viewholder.imageid.equals(imageid)) {             return view;         }         viewholder.imageid = imageid;     }      final file f = getimagefileforposition(position);     picasso         .load(f)         .fit()         .error(r.drawable.broken_image)         .into(viewholder.imageview); } 


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -