This code doesn\'t work:
URL url = new URL( xmlPath );
InputSource input = new InputSource( url.openStream() );
all the time, res
In my case I was downloading an XML file from a URL on my phone but was having the issue describe in this thread.
for fixing it, I not only needed to have the regular internet permission
<uses-permission android:name="android.permission.INTERNET" />
But I also needed
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
As a suggestion to see if your device may need the same thing, try navigating to the URL in your phone's browser to see if prompts about needing SD Card or something.
Hope that helps others.
I have seen this on a phone as well (while doing USB debugging). The solution was to disable WiFi, and re-enable it.
You need to enable internet in your emulator.
Open emulator
Press menu button and open "settings"
Open "wireles and network"
Open "Mobile Networks"
Check on "Data enable"
Now test your application again.
I encountered this problem when I had started the emulator while I was logged on to a VPN. Logging off the VPN had no effect until I quit the emulator and restarted. It is easy to test if your emulator is not resolving names correctly - just go to the emulator browser and type in a website hostname.
Please try rebooting the emulator.
I been follow the steps above but still try no luck, finally i just realize my app did not allow to go outside internet in the emulator. So just add users permissions in your manifest file. Done! Thanks to jozsi see http://www.helloandroid.com/tutorials/how-download-fileimage-url-your-device