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 trialSofya Kozhurinycheva
1,602 PointsRemove 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
31,168 PointsI 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!