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 Moving Work from the Main Thread to an AsyncTask

Issue with connection.getContentLength();

When I follow this project and use my own url, I return a -1 on int contentLength = connection.getContentLength();

I can render this json file fine in iOS, Any Web Browser as well. There is even a header in the file that indicates the content-length. Could it be that it's a large value? 110241.

1 Answer

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Hi Richard,

You're bumping into a known bug with the code. :-/ Sorry about that! I have a note in the Teacher's Notes section that links to a forum post with alternate code you can use.

EDIT: Pasted wrong link. Fixed!