Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my ListView laggy on newer devices, but fast on older devices?

Tags:

android

So I am doing the typical listview viewholder pattern. I am also setting images in a background thread and disabling loading images if the user flings the list.

On older devices (Galaxy s, htc desire, Original Google nexus) my listview works perfectly, no lag at all, even when i scroll/fling the listview. However, on my newer devices (Galaxy S3, Nexus) it is super laggy.

I am performing quite a bit of if/else conditions to setvisibility on certain views. Can this be the root cause? If so why would it be only affecting newer devices?

like image 630
HAxxor Avatar asked Nov 13 '22 19:11

HAxxor


1 Answers

Hard to say without seeing your code. Try hooking the device up to adb, open DDMS and press the method profiling button (icon with 3 arrows and a red dot), then start scrolling a bunch for a few seconds in your app. Press the stop profiling button (same button) and Traceview will open and you see what is using up all the CPU time.

like image 110
satur9nine Avatar answered Nov 15 '22 12:11

satur9nine