[Solved] Android NetworkOnMainThreadException [duplicate]


You are not allowed to do network operations with the Main (UI) thread.

There are several ways of using background threads.
I would recommend using AsyncTask since it has a nice structure which is easy to understand.

http://developer.android.com/reference/android/os/AsyncTask.html

Here is an SO example also: AsyncTask Android example

Should be a lot more available on Google.

2

solved Android NetworkOnMainThreadException [duplicate]