Most efficient way to display 20K+ items in a listview?

jmon

Well-Known Member
Licensed User
Longtime User
hi,

I have this application with a big database, and sometimes I have queries resulting in more than 20000 results. At the moment I use the default listview with 2 lines and bitmap to display the result, but it can get slow on some devices (like 3 - 5 seconds to create the whole list).

My question is if there is a methods that could allow me to speed up this? I like to have results in less than a second. I tried scrollview, but I found it even slower.

Any idea is welcome!

jmon.
 

jmon

Well-Known Member
Licensed User
Longtime User
as I said, "any idea welcome"! Thanks. Actually this is what I am doing at the moment. I have changed the text of the button that executes the query to "Searching..." during the creation of the list.

I had an idea that I will try next, is to use a scrollview and only load the first 500 results. Then I would use the scrollchanged event to measure if the scroll is close to the end of the list. If so, then I would load another 500 results. This method could be fast on the query side, but memorywise, I think it would be slow, and I can imagine some lag during the scroll.
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User

UltimateListView.
 
Upvote 0

demasi

Active Member
Licensed User
Longtime User
I think ExecQueryAsync should be the answer you want. Just add Async to your existing query.
 
Upvote 0

jmon

Well-Known Member
Licensed User
Longtime User
Last edited:
Upvote 0

jmon

Well-Known Member
Licensed User
Longtime User
I think ExecQueryAsync should be the answer you want. Just add Async to your existing query.
Thanks a lot for your suggestion. I think that's exactly what I need. I'll post back after doing some tests.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Loading 20000 bitmaps will be slow. First make sure that you use LoadBitmapSample or you will quickly run out of memory.

Showing a list with 20000 items is in many cases a design issue. Is it sorted in some way? Do you expect the user to go over all the list?

You can use CustomListView class and add new items whenever the user scrolls to the bottom.
 
Upvote 0

jmon

Well-Known Member
Licensed User
Longtime User

Yes, the user might want to scroll quickly through the list. The list is sorted, and it is possible to filter the list too. In most cases I would say that once the user has set the filters, he will end up with a list with a maximum of 2k items.
I will have a look at CustomListview.

Regards

Sent from my GT-P7500 using Tapatalk HD
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…