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.

4

2 回答 2

1

只需将 url 提供给“imgaeUrl”字段

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

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

imageView.setImageBitmap(img );

并设置图像视图

于 2012-12-01T07:14:39.670 回答
0

您可以查看此http://android-developers.blogspot.in/2010/07/multithreading-for-performance.html。它可以带领你

于 2012-12-01T07:33:13.043 回答