title: Display image in android with spaces in filename from online
body: <p>I need to display an image in my android application. The problem is I want to get this image from somewhere online. The URL is like:</p>
  
  <blockquote>
    <p><a href="http://www.mydomain.com/hello" rel="nofollow">http://www.mydomain.com/hello</a> world image.png</p>
  </blockquote>
  
  <p>As you see the image name containing some spaces in it. Every time I execute my code this will show me exception of FileNotFound. and nothing happens.</p>
  
  <p>Following is my code</p>
  
  <pre><code>String imagePathCon = "hello world image.png";      
  String imagePath = "http://www.mydomain.com/" + imagePathCon;
  try {
    URL url;
    url = new URL(imagePath);
  
    // url = new URL("http://www.azuma-kinba.com/wp-content/uploads/2012/05/Android-Make-Google-Loss-in-2010.png");
  
    InputStream content = (InputStream)url.getContent();
    Drawable d = Drawable.createFromStream(content , "src"); 
    im.setImageDrawable(d);
  
   } catch (MalformedURLException e) {
              e.printStackTrace();
   } catch (IOException e) {
              e.printStackTrace();
   }
  </code></pre>
  
  <p>I use to replace space with "+" but nothing happens. </p>