Big ListView in Android

Building a vocabulary application I need a ListView that displays over 100k items. I want the user to scroll as much as necessary.

What is the best practice for finding and displaying words?
Is it possible to show 150,000 words in a ListView (for execution)? If not, how to add another 100 words after the user reaches the end of the list?

Currently, I am showing 50 words earlier and 50 words of the next searched word.

Thanks.

+6
android listview
source share
3 answers

(second answer in response to a clarification on performance)

There are various ways to do this based on where your data is.

It is best to have your data in a sqlite database and use the CursorAdapter . Then Android controls the extraction of your data and will not receive data that is not currently displayed on the screen.

If your words are in an array in memory, try the ArrayAdapter or SimpleAdapter .

The adapter interface from which all inherited classes are inherited is designed to provide good ListView performance regardless of the number of objects in the list.

+9
source share

One built-in way to provide quick scrolling is a quick scroll pointer. In xml, set:

android:fastScrollEnabled="true"

in ListView or try:

 listView.setFastScrollEnabled(true) listView.setFastScrollAlwaysVisible(true) 
+2
source share

RecyclerView is very good for this. I developed an open source library specifically designed to scroll through a large list with extreme speed. In fact, it can move more than 1000 elements per second in both single and multi-line layouts. Here you can check the repo: https://bitbucket.org/warwick/hgfastlist or you can check the OpenGL version here: https://bitbucket.org/warwick/hgglfastlist . Here is a demo video on Youtube: https://www.youtube.com/watch?v=oz7aeAlOHBA&feature=youtu.be Even if you do not want to use this library, a demo application will be loaded with reading code that will give you good ideas.

0
source share

All Articles