Android - read text file from server crashes
<p>This causes my app to force close and I can't figure out why:</p>

<pre><code>TextView tv = (TextView) findViewById(R.id.textView1);

    try {
        InputStream is = new URL("http://test.com/file.txt").openStream();
        BufferedReader in = new BufferedReader(new InputStreamReader(is));
        String str = in.readLine();
        in.close();
        tv.setText(str);
    } catch (MalformedURLException e) {
        //FAIL
    } catch (IOException e) {
        //FAIL
    }
</code></pre>

<p>Obviously my real URL is valid.</p>
