android - Unable to resolve host "<insert URL here>" No address associated with hostname -


i tried following tutorial: getting data web

i tried implementing on android 3.0, latest platform tablets, however, error: "unable resolve host "www.anddev.org" no address associated hostname."

you can checkout url used prove file exists. http://www.anddev.org/images/tut/basic/getdatafromtheweb/loadme.txt

i created private class , extended asynctask. here code:

    private class downloader extends asynctask<string,void,string>{     string mystring = null;     @override     protected string doinbackground(string... arg0) {         try{             url myurl = new url("http://www.anddev.org/images/tut/basic/getdatafromtheweb/loadme.txt");             urlconnection ucon = myurl.openconnection();             inputstream = ucon.getinputstream();             bufferedinputstream bis = new bufferedinputstream(is);              bytearraybuffer baf = new bytearraybuffer(50);             int current = 0;             while((current=bis.read())!=-1){                 baf.append((byte)current);             }             mystring = new string (baf.tobytearray());         }catch(exception e){             mystring = e.getmessage();         }         return mystring;     } @override protected void onpostexecute(string result){     tv.settext(result); } } 

any out there appreciated.

my bet forgot give app permission use internet. try adding android manifest:

<uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> 

Comments