title: Android can't read from URL
body: <p>I'm having trouble reading text from a file in the Android workspace using the URL class. I get a NetworkOnMainThreadException. The same exact code works outside of the Android workspace, so it must be a network or permissions issue. I've generated a basic text file from the link specified. 
  It appears that it is failing on url.openStream.
  Below is my code, followed by my manifest file (where I've added the uses-permissions line already.) </p>
  
  <pre><code>  static public String[] barList()
  { 
     ArrayList&lt;String&gt; bars = new ArrayList&lt;String&gt;();
     try{
         URL url = new URL("****");
         BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
         String line = br.readLine();
         while(line != null)
         {
             bars.add(line);
             line = br.readLine();
         }
         br.close();
     }
     catch (IOException e) {
         e.printStackTrace();
     }
     return (String[])bars.toArray();
  }
  </code></pre>
  
  <p>Here is the manifest file.</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="aexp.explist"&gt;
  &lt;application&gt;
      &lt;activity android:name=".ExpList" android:label="ExpList"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  &lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt;
  &lt;/manifest&gt; 
  </code></pre>