title: Android - Unhandled java.net.MalformedURLException
body: <p>I'm getting a MalformedURLException some code in my Android Studio project. My aim is to get and display an image from a web page, and the URL seems to be fine, but it's giving me this error.</p>
  
  <p>I have already put the code in a <code>try</code>,<code>catch</code>, but that is still giving me the error.
  Here is the code to grab the image and display it:</p>
  
  <pre><code>    try
      {
          url = new URL(items.get(position).getLink());
          bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
      }
      catch (IOException e)
      {
          throw new RuntimeException("Url Exception" + e);
      }
  
      holder.itemTitle.setText(items.get(position).getTitle());;
      holder.itemHolder.setBackgroundDrawable(new BitmapDrawable(bmp));
  </code></pre>
  
  <p><code>items.get(position).getLink()</code> is meant to get the link that is being displayed in a <code>ListView</code>, but even something like <code>URL url = new URL("https://www.google.com")</code> doesn't work.</p>
  
  <p>Thanks.</p>