Welcome to the Treehouse Community
Looking to learn something new?
Naomi Touchet11,300 Points
How can I implement an infinitely scrolling list of items in my Android app?
I'm creating an app which will let people read through 1,000 different answers to commonly asked questions. I want them to be able to read through all of the answers (I was thinking it would work best to implement some sort of infinitely scrolling list) as well as to be able to read through the answers by category. Does anyone know the best way to do this? I would also appreciate if anyone knows any good resources to direct me towards.
I'm also wondering if I should use a database or if I should just use an array. (Right now I have it set up as an array, but I've only put in a couple of the answers. I'm not sure if an array will work once I have all 1,000 answers entered.)
Ben JakubenTreehouse Teacher
For the ListView itself, I'd recommend looking at a 3rd party library so you don't have to reinvent the wheel about making an infinite ListView. Check out this one, for example: https://github.com/weixiao1984/Android-Infinite-Scroll-Listview
As for your data, it sounds like a database might be appropriate for your answers. Our Data Persistence course is almost ready and should be able to help you. But an array might actually be just fine. There's no need to over-complicate it if an array is good enough for your purposes. An array of 1000 items just depends on the type of item being stored. The more complex the data object, the more memory it will take up.