title: Android Studio: Save URLS from a URL to an array
body: <p>I am trying to have Android Studio read a text file from a URL into a string array. Then, use the URLS within Picasso to display a simple gallery. My attempts at achieving this are below.</p>
  
  <p>My <code>GrabData.java</code> script:</p>
  
  <pre><code>public class GrabData
  {
  static public String[] LIST = {};
  public static void main(String[] args)
  {
  
      ReadFile rf = new ReadFile();
  
      // The text file.
      String filename = "http://www.example.com/my/website/directory/thefile.txt";
  
      try
      {
          String[] LIST = rf.readLines(filename);
  
          for (String line : LIST)
          {
              System.out.println(LIST);
          }
      }
      catch(IOException e)
      {
          System.out.println("ReadFile : Unable to create "+filename+": "+e.getMessage());
      }
    }
  }
  </code></pre>
  
  <p>My <code>ReadFile.java</code> script:</p>
  
  <pre><code>public class ReadFile extends Activity
  {
  public String[] readLines(String filename) throws IOException
  {
      FileReader fileReader = new FileReader(filename);
  
      BufferedReader bufferedReader = new BufferedReader(fileReader);
      List&lt;String&gt; lines = new ArrayList&lt;String&gt;();
      String line = null;
  
      while ((line = bufferedReader.readLine()) != null)
      {
          lines.add(line);
      }
  
      bufferedReader.close();
  
      return lines.toArray(new String[lines.size()]);
    }
  }
  </code></pre>
  
  <p>However, when I try to use a URL in the filename string, it doesn't display any images on the gallery, which is able to load from arrays. I am guessing this method can't read URLS. If anyone has any help on how to get this, it is much appreciated.</p>