Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Loading more items to ListView when user scrolls to bottom

Hello,

I am working on a project similar to the Blog reader app and I am faced with a problem. I need to display more items in a list when user scrolls to the bottom of the list.

So with Blog reader app this would work something like this: On startup the app loads 20 newest blog posts (like it does now) and when user scrolls to the bottom of the list (20th item is visible), the program automatically loads next 20 blog posts, so now the list would contain 40 newest blog posts.

If someone could point me to the right direction in how to do this for example with the Blog reader app, I would truly appreciate it!

Thank you!

1 Answer

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Here's a pretty good example from GitHub that you could either use directly or modify for your own purposes: Android-Infinite-Scroll-Listview

Thanks for the reply Ben! I checked your suggestion out but I had some trouble importing the library, because I am not sure how to add a project as a library reference (I'm using Android Studio). After all I managed to find another solution and got it working in my app: http://mobile.dzone.com/news/android-tutorial-dynamicaly .

The example you suggested seemed like a more solid way to establish endless listview though, so I'm sure to delve into it more when I have more time.