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

AS Logged only 10 posts instead of 20. Could it be because there are 10 on page 1 and others are on page 2? //with code

So when I try to log the posts with

Log.v(TAG, "Post " + i + ": " + title);

Android Studio only loggs the first 10 posts (from 0 to 9). I noticed that in the blog page there are exactly those 10 posts on page 1. So I am guessing Android Studio can't go to page 2. I made sure that my NUMBER_OF_POSTS varialbe is 20.

Here's my code:

Variables:

public static final int NUMBER_OF_POSTS = 20;
public static final String TAG = MainListActivity.class.getSimpleName();

If statement inside "onCreate" function:

if (isNetworkAvailable()) {
  GetBlogPostsTask getBlogPostsTask = new GetBlogPostsTask();
  getBlogPostsTask.execute();
}
else {
  Toast.makeText(this, "Network is unavailable!", Toast.LENGTH_LONG).show();
}

I've paste my "GetBlogPostsTask" in pastebig, since it's quite big and I don't want to make the post huge. Here's the link - http://pastebin.com/5t6mZJX3

Biliana Atanasova
Biliana Atanasova
8,365 Points

Off topic

Hi Kristian,

Can you please check your facebook? I wrote you a message there.

Thanks:)

1 Answer

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

I know this is a really late reply, but in case this helps anyone else, you need to update this code based on the Teacher's Notes that link to this post in the Forum: https://teamtreehouse.com/forum/parsing-data-returned-in-json-jsonexception-unterminated-string-at-character-5792

On a related note, this course will be retired as soon as I finish up my next course which is due in about a month.

Thank you for your reply Ben :) But I am afraid I left this course behind since I struggled with another error to which I couldn't quite find the asnwer.

(On a related note) - Any reveals on what the course will be about? Another app or?

Charles Li
Charles Li
15,557 Points

Thank you Ben for your reply!