title: Get Bitmap from an URL
body: <p>I am trying to GET a Bitmap image from a URL.<br />
  (Example: <a href="https://cdn.bulbagarden.net/upload/9/9a/Spr_7s_001.png" rel="nofollow noreferrer">https://cdn.bulbagarden.net/upload/9/9a/Spr_7s_001.png</a>)</p>
  <p>But there seems to be a problem with the <code>connection.connect()</code> line, that I can't figure out.<br />
  I have allowed internet access in the app.</p>
  <pre><code>public static Bitmap getBitmapFromURL(String src) {
      HttpURLConnection connection = null;
      InputStream inputStream = null;
      try {
          URL url = new URL(src);
          connection = (HttpURLConnection) url.openConnection();
          connection.setRequestMethod(&quot;GET&quot;);
          connection.setDoInput(true);
          connection.connect();
      }
      return BitmapFactory.decodeStream(inputStream);
  }  
  </code></pre>