Hi,

I am trying to fetch an image and render it in an activity. But I keep
getting a MalformedURLException.

Here's my code snippet:

protected void onCreate(Bundle savedInstanceState) {
                // TODO Auto-generated method stub
                super.onCreate(savedInstanceState);
                String img = "http://chart.apis.google.com/chart?cht=p3&chd=t:
60,40&chs=250x250&chl=Hello|World";
                URL imgUrl;
                try {
                        imgUrl = new URL(img);
                } catch (MalformedURLException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
        ImageView imgViewer = new ImageView(this);
        imgViewer.setImageBitmap(BitmapFactory.decodeStream
(imgUrl.openStream()));
        setContentView(imgViewer);
        }

Thoughts?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to