title: Android FileNotFound Exception - Cannot getInputStream from image URL that does not have file format
body: <p>The title is pretty self explanatory.</p>
  
  <p>the following code...:</p>
  
  <pre><code>    URL imageUrl = new URL(url);
     try {
                  HttpURLConnection conn= (HttpURLConnection)imageUrl.openConnection();
                  conn.setDoInput(true);
                  conn.connect();
                  int length = conn.getContentLength();
                  InputStream is = conn.getInputStream();
                  return BitmapFactory.decodeStream(is);
             } catch (IOException e) {
              e.printStackTrace();
             }
  </code></pre>
  
  <p>Will fail if the url does not contain the file format. For example, some images hosted by google will display the image yet not have the file format (.png, .jpg, etc) as part of the url. </p>
  
  <p>As a result, the content-type header of the url connection returns "text/html". I believe this is the issue.</p>
  
  <p>I have tried setting a new content-type header, but that doesnt seem to change anything.</p>
  
  <p>anybody know a workaround?</p>
  
  <p>thanks.</p>