QuickReturnListView
QuickReturnListView copied to clipboard
ListView rendering the whole set of rows
I came to a situation with the QuickReturnListView where I noticed that the ListViewadapter is loading the whole set of rows, for example I have ListView with 21 rows, I have traced getView
method on the baseAdapter and I found it's loading the whole 21 rows sequentially where the ListView should only load the visible item.
I have tried to remove "getComputedScrollY" method from "QuickReturnListView" class and the ListViewis no longer loading the whole set.
Thanks.
This is working as expected as the computeScrollY literally gets the view from getView and then calculates the height for each view among other things. It should only happen once during onGlobalLayout though.
If you know that all your items have the same height, then you should change the computeScrollY() method and only measure the height of one of them (before the for loop) and inside the for just add the calculated height to all items. It improves the performance drastically. Be careful if you have a header or footer.