thisThis happens in Android 3.0 and above From. From Android 3.0 and above, they have restricted using network operations (functions that access the internetInternet) from running in the main thread/uIUI thread (what spawns from your on create and on resume methods in the activity) This.
This is to encourage using separate threads for network operations. See asynctask See AsyncTask for more details on how to perform network activities the right way http://developer.android.com/reference/android/os/AsyncTask.html.