title: set url image to image view
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4509912/is-it-possible-to-use-bitmapfactory-decodefile-method-to-decode-a-image-from-htt">Is it possible to use BitmapFactory.decodeFile method to decode a image from http location?</a>  </p>
  </blockquote>
  
  
  
  <p>i have a problem in set url image to image view. i tried below methods </p>
  
  <p>Method 1:</p>
  
  <pre><code>Bitmap bimage=  getBitmapFromURL(bannerpath);
  image.setImageBitmap(bimage);
  
   public static Bitmap getBitmapFromURL(String src) {
          try {
              Log.e("src",src);
              URL url = new URL(src);
              HttpURLConnection connection = (HttpURLConnection) url.openConnection();
              connection.setDoInput(true);
              connection.connect();
              InputStream input = connection.getInputStream();
              Bitmap myBitmap = BitmapFactory.decodeStream(input);
              Log.e("Bitmap","returned");
              return myBitmap;
          } catch (IOException e) {
              e.printStackTrace();
              Log.e("Exception",e.getMessage());
              return null;
          }
      }
  </code></pre>
  
  <p>Method 2:</p>
  
  <pre><code>    Drawable drawable = LoadImageFromWebOperations(bannerpath);
      image.setImageDrawable(drawable);
  
       private Drawable LoadImageFromWebOperations(String url)
      {
           try
           {
               InputStream is = (InputStream) new URL(url).getContent();
               Drawable d = Drawable.createFromStream(is, "src name");
               return d;
           }catch (Exception e) {
               System.out.println("Exc="+e);
               return null;
           }
       }
  </code></pre>
  
  <p>i tried above two methods but are not working . both are showing DEBUG/skia(266): --- decoder->decode returned false .  i used demo url image paths that is working. but this path is not working .so please tell me what is the wrong and what i will do </p>
  
  <p>Thank you in advance.</p>
  
  <p>Best Regards.</p>