Reading file from localhost
<p>I am trying to read a text file from my localhost (WAMP), but getting nothing back. 
Could someone point out what I am doing wrong please.
This is how I am trying to achieve it. </p>

<pre><code>        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) {      }
</code></pre>

<p>It works with a true URL, but not whenever I use localhost. I have tried using <em>localhost</em> and <em>127.0.0.1</em> in URL too.</p>
