Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android

Endless scroll in listview for the blogreader

Hi Ben,

I have finished the blog reader app. I also added a custom listview to show the thumbnail. I was wondering how do I add endless scroll to the blog reader app? Also is there an api call to load data by mentioning the start and end position ? For example http://blog.teamtreehouse.com/api/get_recent_summary/?start=10&end=20.

Also one of the problem I face with the blog reader app is that when I increase the count in the url the app never loads. Data is truncated while reading the json and I see an exception.

How should I fix these problems so that the app becomes more usable ?

Thanks

1 Answer

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Good question! There are two parts, so I'll try to answer both:

  1. Regarding the error you see trying to get more posts--that's a known issue that you can fix with some alternate code. Check the Teacher Notes in this video for a link to a Forum post with code that fixes the issue. Put that in place and you can request a higher number of posts.

  2. For endless scrolling, check out this library from GitHub: https://github.com/thecodepath/android_guides/wiki/Endless-Scrolling-with-AdapterViews. You could request more posts at the beginning and chunk them together, or you could use different methods from the API we are using. Check out the docs here to see about how you could possibly request different sets of posts: https://wordpress.org/plugins/json-api/other_notes/ (Perhaps get_date_posts could be useful.) Though I'm not entirely sure if we enabled all the different API calls or not on our blog!

Hi ben, I have the same problem of endless scrolling and as you suggested I tried the library from GitHub but I am not able to load more data. If I am specifying the number of post to be 10 then either the same data is showing on scroll end or the new data is overlapping the current list. The new data is not appending to the current list of data. Please if you could guide me with it, it would be a great help.

Ben Jakuben
Ben Jakuben
Treehouse Teacher

HI Karan,

If you can, post a new question with details and your code and we can try to help you out. :)