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 Android Lists and Adapters Connecting the Data Wrapping Up

Remove Recyclerview infinite scroll

https://teamtreehouse.com/library/android-lists-and-adapters-2 In the end, we got the app, where you can endlessly scroll through the data. Thus, if the weather forecast is given in the next 12 hours, after scrolling for 12 hours, we will see the forecast for the first hour, the second hour, ... How to fix it?

1 Answer

Jeremiah Shore
Jeremiah Shore
31,168 Points

I recommend checking where you are parsing the JSON data into the hourly forecast. Sounds like there might be a problem with your loop condition or with how you're retrieving the data JSONObject (where the hourly data is held as an array).

You may also want to double check the raw JSON data coming from DarkSky, and your expectations. When I was looking over your question, I noticed there was more data on my list than expected. Per their API documentation, "The hourly data block will contain data points starting at midnight (local time) of the day requested, and continuing until midnight (local time) of the following day." So, there should 49 hours returned. However, I don't recommend setting that as a static value, though it may sound tempting.

Try using the debugger within getHourlyForecast() and see what you can come up with. Be sure to let us know if you figure it out!