You should remember this.
From Android 3.x Honeycomb or later, you cannot perform Network IO on the UI thread and doing this throws android.os.NetworkOnMainThreadException. You must use Asynctask .
You have to put your getXmlFromUrl(..)
code inside Asynctask method
For more Information Refer this Link http://developer.android.com/reference/android/os/AsyncTask.html