2 messages in com.googlegroups.android-beginners[android-beginners] Re: Problem in us...
FromSent OnAttachments
Ravi Savaliya23 Jun 2008 00:32 
Fräntz Miccoli24 Jun 2008 01:27 
Subject:[android-beginners] Re: Problem in using ImageView
From:Fräntz Miccoli (fran@gmail.com)
Date:06/24/2008 01:27:46 AM
List:com.googlegroups.android-beginners

Hello Ravi,

I've solved this problem through an Input Stream I give you my code :

first how to put this stream in my imageView, mThumbnail: mThumbnail.setImageDrawable(imageOperations(url, "name.jpg"));

now my imageOperations method :

public static Drawable imageOperations(String url, String saveFilename) { try { InputStream is = (InputStream) fetch(url); Drawable d = Drawable.createFromStream(is, "src"); return d; } catch (MalformedURLException e) { e.printStackTrace(); return null; } catch (IOException e) { e.printStackTrace(); return null; } }

and the fetch method : private static Object fetch(String address) throws MalformedURLException,IOException { URL url = new URL(address); Object content = url.getContent(); return content; }

It might not be the best way but it works. I found it on a blog... don't remember which one.

Nice day.

Fräntz

On 23 juin, 09:32, Ravi Savaliya <ravi@gmail.com> wrote:

I am try to display image from internet. I have url  of image , that i passed in constructing URI ref.

screen display blank

here is code,

-----------------------------------------------------------------------------------------------------------------------------------       ImageView imageView = (ImageView) findViewById(R.id.imageView);

      Uri uri=Uri.parse("http://static.px.yelp.com/upthumb/ q0POOE3vv2LzNg1qN8MMyw/ms");       imageView.setImageURI(uri);        setContentView(imageView);

-----------------------------------------------------------------------------------------------------------------------------------

any reply is appreciable

thanks