0

Possible Duplicate:
how to implement lazy loading of images in gridview

How to fetch multiple images from url using Drawable in android?

private Drawable LoadImageFromWebOperations(String url) {
        try {
            InputStream is = (InputStream) new URL(url).getContent();
            Drawable d = Drawable.createFromStream(is, "icon");
            return d;
        } catch (Exception e) {
            System.out.println("Exc=" + e);
            return null;
        }
    }

I'm using this function to return drawable image but I'm not getting how to bind list of images to gridview..

Please help me.

Community
  • 1
  • 1
shivani patel
  • 225
  • 1
  • 8
  • 22
  • Try looking into this [Link](https://github.com/nostra13/Android-Universal-Image-Loader). It does a lot of work out of the box for you – Abhay Kumar Dec 01 '12 at 07:15

2 Answers2

1

Simply give url to "imgaeUrl" field

URL url = new URL(imageUrl);
HttpURLConnection connection  = (HttpURLConnection) url.openConnection();

InputStream is = connection.getInputStream();
Bitmap img = BitmapFactory.decodeStream(is);  

imageView.setImageBitmap(img );

and set imageview

QuokMoon
  • 4,387
  • 4
  • 26
  • 50
0

You can check this http://android-developers.blogspot.in/2010/07/multithreading-for-performance.html. It can lead you

Shrikant
  • 1,560
  • 1
  • 15
  • 32