android - Reading file from localhost -


i trying read text file localhost (wamp), getting nothing back. point out doing wrong please. how trying achieve it.

        try {         url url = new url("http://10.0.2.2/text.txt");         bufferedreader in = new bufferedreader(new inputstreamreader(url.openstream()));                    while ((str = in.readline()) != null) {                             tv.append(str);         }         in.close();     } catch (malformedurlexception e) {     } catch (ioexception e) {      } 

it works true url, not whenever use localhost. have tried using localhost , 127.0.0.1 in url too.


Comments