udacity/Sunshine-Version-2

Network Code

Opened this issue · 1 comments

Network code in this branch is not working, giving "Network on main thread" exception. Is there any correction in code where network code is separated from UI using async tasks?

Yea, branch 2.1 doesn't run.

I was able to make it run after restructuring the code and creating a new thread using an AsyncTask. Here is a great article on why you can't network in the main thread and here is some documentation on networking and using AsyncTask.

Edit:
After moving on in the course, it looks like their error was totally intentional! It was just a fun learning task. = )