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 Using Intents to Display and Share Posts Opening a Webpage in the Browser

Mr Mac
Mr Mac
8,213 Points

Using Intents to Display and Share Posts Video

Hi, I've followed the instructions in the video all the way to the end however, upon reaching the bit where is up to: *"String blogUrl = jsonPosts.getString("url")" the url is underlined red.

I have used the auto completion have when it is fixed by : *String blogUrl = jsonPosts.getString(Integer.parseInt("url")); the emulator works and displays the titles but when i click into the website it crashes and exits the application.

I see there is the variable log say "Disconnected from the target VM, address: 'local host :8606', transport 'socket'."

I have been stuck on this for a while now trying to look through the coding.

alt text

alt text

Cheers

Mr Mac
Mr Mac
8,213 Points

To clarify this is part of the "Build a Blog Reader App" - First Video "Using Intents to Display and Share Posts".

Tree House wouldn't let me put in a longer title for the description.

1 Answer

You're trying to get the url from the JSONArray instead of the JSONObject, so try this:

String blogUrl= jsonObject.getString("url");
Mr Mac
Mr Mac
8,213 Points

Thanks, It works! Looks like I'll have to look more into the formula.

Cheers!