If you are executing this on API level 11 or above, it might be related to doing blocking network operations on the main thread (onResume is executed on the main thread, thus blocking UI updates). This answer should be of help: https://stackoverflow.com/a/6343299/1045199
Source: http://developer.android.com/reference/android/os/NetworkOnMainThreadException.html
P.S. you really should post the exception stacktrace to let others know what is the actual error.