Here is the code that I have been using, first it will display the
image cached on the android app and then lazy load the other image
from the web but from the debugger, it does not look like it fully
works...

final ImageView i = new ImageView(mContext);
                    i.setLayoutParams(new GridView.LayoutParams(100,100));
                i.setScaleType(ImageView.ScaleType.CENTER_CROP);
                i.setPadding(8, 8, 8, 8);
                i.setAdjustViewBounds(true);
                i.setImageResource(R.drawable.igift);
                i.post(new Runnable() {
                                        public void run() {
                                                
i.setImageDrawable(util.getDrawable(items.get
(position).getImageUrlForItemDetail()));
                                        }});


//androidUtility class to get the image from an URL
        public Drawable getDrawable(String imgUrl) {
                try {
                        URL url = new URL(imgUrl);
                        InputStream is = (InputStream) url.getContent();
                        Drawable d = Drawable.createFromStream(is, "src");
                        return d;
                } catch (MalformedURLException e) {
                        e.printStackTrace();
                        return null;
                } catch (IOException e) {
                        e.printStackTrace();
                        return null;
                }
        }


thanks !!!

jb
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to