2 messages in com.googlegroups.android-beginners[android-beginners] Re: Problem in us...| From | Sent On | Attachments |
|---|---|---|
| Ravi Savaliya | 23 Jun 2008 00:32 | |
| Fräntz Miccoli | 24 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
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to andr...@googlegroups.com To unsubscribe from this group, send email to andr...@googlegroups.com Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---




