Hi,

You can see how I did in the source code of Shelves: code.google.com/p/shelves

On Wed, Jan 28, 2009 at 8:41 AM, jbpring...@gmail.com
<jbpring...@gmail.com> wrote:
>
> 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
> >
>



-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~
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