title: Jsoup not connecting to webpage in Android Studio
body: <p>I am working on a project right now where I use jsoup in a class with the function retrieveMedia in order to return an ArrayList filled with data from the webpage. I run it in a thread since you shouldn't be connecting to URLs from the main thread. I run it and join it. However, it doesn't work (I tested the same code in Eclipse separate from Android Studio and it worked fine). It seems that no matter what I do I can't get jsoup to connect to the webpage. Below is my class MediaRetriever.</p>
  <pre><code>public class MediaRetreiever {
  
      public ArrayList&lt;Media&gt; retrieveMedia() {
          ArrayList&lt;Media&gt; mediaOutput = new ArrayList&lt;Media&gt;(); //Store each scraped post
          Thread downloadThread = new Thread(new Runnable() {
              public void run() {
                  Document doc = null;
                  try {
                      doc = Jsoup.connect(&lt;Website Im connecting to&gt;).timeout(20000).get();
                  } catch (IOException e) {
                      System.out.println(&quot;Failed to connect to webpage.&quot;);
                      mediaOutput.add(new Media(&quot;Failed to connect&quot;, &quot;oops&quot;, &quot;&quot;, &quot;oh well&quot;));
                      return;
                  }
                  
                  Elements mediaFeed = doc.getElementById(&quot;main&quot;).getElementsByClass(&quot;node&quot;);
  
                  for (Element e : mediaFeed) {
                      String title, author, imageUrl, content;
                      title=e.getElementsByClass(&quot;title&quot;).text().trim();
                      author=e.getElementsByClass(&quot;content&quot;).tagName(&quot;p&quot;).select(&quot;em&quot;).text().trim();
                      content=e.getElementsByClass(&quot;content&quot;).text().replace(author,&quot;&quot;).trim();
                      Media media = new Media(title, author, &quot;&quot;, content);
                      mediaOutput.add(media);
                  }
              }
          });
          downloadThread.start();
          try {
              downloadThread.join();
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
  
          
          return mediaOutput;
  
      }
  }
  </code></pre>
  <p>Running this class's method from another class and it doesn't ever connect. Any ideas?</p>