This is most common issue. You cant process any network operation in UI thread. That means you cant access, process, or get anything from internet directly from your activity. This is restricted by default in android to maintain application responsiveness. The logcat clearly shows it by
Caused by: android.os.NetworkOnMainThreadException
Solution :
you have to use AsyncTask class for any network operation. just put everything cpu time consuming process, or long data download in doInBackground()
method. after getting the data show it in onPostExcecute()
method.
android reference:
http://developer.android.com/reference/android/os/AsyncTask.html
Complete Turtorials:
http://www.androidhive.info/2012/04/android-downloading-file-by-showing-progress-bar/
http://samir-mangroliya.blogspot.com/p/android-asynctask-example.html