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 trialAlok Singh
Courses Plus Student 3,397 Pointswhy is there indexOutOfBound exception ?
this = {MainActivity@5016} jsonData = "{"latitude":37.8267,"longitude":-122.423,"timezone":"America/Los_Angeles","currently":{"time":1508937910,"summary":"Clear","icon":"clear-night","nearestStormDistance":416,"nearestStormBearing":357,"precipIntensity":0,"precipProbability":0,"temperature":60.1,"apparentTemperature":60.1,"dewPoint":49.39,"humidity":0.68,"pressure":1015.62,"windSpeed":2.5,"windGust":3.48,"windBearing":29,"cloudCover":0,"uvIndex":0,"visibility":10,"ozone":241.7},"minutely":{"summary":"Clear for the hour.","icon":"clear-night","data":[{"time":1508937900,"precipIntensity":0,"precipProbability":0},{"time":1508937960,"precipIntensity":0,"precipProbability":0},{"time":1508938020,"precipIntensity":0,"precipProbability":0},{"time":1508938080,"precipIntensity":0,"precipProbability":0},{"time":1508938140,"precipIntensity":0,"precipProbability":0},{"time":1508938200,"precipIntensity":0,"precipProbability":0},{"time":1508938260,"precipIntensity":0,"precipProbability":0},{"time":1508938320,"precipIntensity":0,"precipPro" root = {JSONObject@5021} "{"latitude":37.8267,"longitude":-122.423,"timezone":"America\/Los_Angeles","currently":{"time":1508937910,"summary":"Clear","icon":"clear-night","nearestStormDistance":416,"nearestStormBearing":357,"precipIntensity":0,"precipProbability":0,"temperature":60.1,"apparentTemperature":60.1,"dewPoint":49.39,"humidity":0.68,"pressure":1015.62,"windSpeed":2.5,"windGust":3.48,"windBearing":29,"cloudCover":0,"uvIndex":0,"visibility":10,"ozone":241.7},"minutely":{"summary":"Clear for the hour.","icon":"clear-night","data":[{"time":1508937900,"precipIntensity":0,"precipProbability":0},{"time":1508937960,"precipIntensity":0,"precipProbability":0},{"time":1508938020,"precipIntensity":0,"precipProbability":0},{"time":1508938080,"precipIntensity":0,"precipProbability":0},{"time":1508938140,"precipIntensity":0,"precipProbability":0},{"time":1508938200,"precipIntensity":0,"precipProbability":0},{"time":1508938260,"precipIntensity":0,"precipProbability":0},{"time":1508938320,"precipIntensity":0,"precipPr" timezone = "America/Los_Angeles" hourly = {JSONObject@5023} "{"summary":"Clear throughout the day.","icon":"clear-day","data":[{"time":1508936400,"summary":"Clear","icon":"clear-night","precipIntensity":0,"precipProbability":0,"temperature":60,"apparentTemperature":60,"dewPoint":49.47,"humidity":0.68,"pressure":1015.64,"windSpeed":1.97,"windGust":2.97,"windBearing":27,"cloudCover":0,"uvIndex":0,"visibility":10,"ozone":241.62},{"time":1508940000,"summary":"Clear","icon":"clear-night","precipIntensity":0,"precipProbability":0,"temperature":60.24,"apparentTemperature":60.24,"dewPoint":49.27,"humidity":0.67,"pressure":1015.59,"windSpeed":3.23,"windGust":4.19,"windBearing":30,"cloudCover":0,"uvIndex":0,"visibility":10,"ozone":241.82},{"time":1508943600,"summary":"Clear","icon":"clear-day","precipIntensity":1.0E-4,"precipProbability":0.02,"precipType":"rain","temperature":61.95,"apparentTemperature":61.95,"dewPoint":49.3,"humidity":0.63,"pressure":1015.58,"windSpeed":4.33,"windGust":5.47,"windBearing":33,"cloudCover":0,"uvIndex":0,"visibility":10,"ozo" data = {JSONArray@5024} "[{"time":1508936400,"summary":"Clear","icon":"clear-night","precipIntensity":0,"precipProbability":0,"temperature":60,"apparentTemperature":60,"dewPoint":49.47,"humidity":0.68,"pressure":1015.64,"windSpeed":1.97,"windGust":2.97,"windBearing":27,"cloudCover":0,"uvIndex":0,"visibility":10,"ozone":241.62},{"time":1508940000,"summary":"Clear","icon":"clear-night","precipIntensity":0,"precipProbability":0,"temperature":60.24,"apparentTemperature":60.24,"dewPoint":49.27,"humidity":0.67,"pressure":1015.59,"windSpeed":3.23,"windGust":4.19,"windBearing":30,"cloudCover":0,"uvIndex":0,"visibility":10,"ozone":241.82},{"time":1508943600,"summary":"Clear","icon":"clear-day","precipIntensity":1.0E-4,"precipProbability":0.02,"precipType":"rain","temperature":61.95,"apparentTemperature":61.95,"dewPoint":49.3,"humidity":0.63,"pressure":1015.58,"windSpeed":4.33,"windGust":5.47,"windBearing":33,"cloudCover":0,"uvIndex":0,"visibility":10,"ozone":241.99},{"time":1508947200,"summary":"Clear","icon":"clear-da" hours = {Hour[49]@5025} i = 49 hours[i] = java.lang.IndexOutOfBoundsException : Invalid array range: 49 to 49
1 Answer
suliman alkous
Courses Plus Student 5,139 PointsI don't know what happens but out of bounds that means you try to get item with index more than index in array. for example if your array length is 49 that mean the range of index is from 0 to 48 not 49.