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 Build a Blog Reader Android App Getting Data from the Web Parsing Data Returned in JSON Format

problem in code challenge

In this code challenge, it gives me the error that I have not logged the book according to instructions, however the instructions do not make it clear how to get the page number and title. Can somebody please tell me how to do this, or how you finished this code challenge. Thanks

1 Answer

Theodore Kruczek
Theodore Kruczek
8,800 Points

Let me try to give you a hint rather than posting the answer:

for(int i = 0; i < jsonBooks.length(); i++){
        //Omitted Code that declares two string variables "title" and "pages" using .getJSONObject(i)
        Log.i("CodeChallenge", title + ", " + pages);
}