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

Android - BlogReader app stopped

I am in the BlogReader project and I am using both Eclipse and Genymotion emulators. All of a sudden when I loaded the app it shows me "Unfortunately, the BlogReader has stopped."

I am not sure what happened. Does anyone know why this happens?

Thanks a lot!

2 Answers

It looks like the problem is that you're doing network activity on the main thread. You can see that on this line

03-06 00:06:12.122: E/AndroidRuntime(975): Caused by: android.os.NetworkOnMainThreadException

Network activity needs to be done in an AsyncTask. Ben talks about that in the lesson. If I remember correctly, the initial version of the blog reader that Ben writes encounters this same problem that you have. He does that on purpose to demonstrate that you can't do network activity on the main thread. If you're on the initial version of his program (before he fixes it either later in that lesson or in the next lesson), then that error is what's to be expected and there's no problem.

Wow I somehow missed that entire lesson. My fault. Thanks!