Hi ayush,

see the below code, it might help you
                        URL aURL = null;
                        try
                        {
                                aURL = new URL(imgUrl);
                        }
                        catch (MalformedURLException e1)
                        {
                                // TODO Auto-generated catch block
                                e1.printStackTrace();
                        }
                        URLConnection conn = null;
                        try
                        {
                                conn = aURL.openConnection();
                        }
                        catch (IOException e1)
                        {
                                // TODO Auto-generated catch block
                                e1.printStackTrace();
                        }
                        try
                        {
                                conn.connect();
                        }
                        catch (IOException e1)
                        {
                                // TODO Auto-generated catch block
                                e1.printStackTrace();
                        }
                        InputStream is = null;
                        try
                        {
                                is = conn.getInputStream();
                        }
                        catch (IOException e1)
                        {
                                // TODO Auto-generated catch block
                                e1.printStackTrace();
                        }
                        BufferedInputStream bis = new
BufferedInputStream(is,8*1024);
                        bm = BitmapFactory.decodeStream(bis);
                        imgV.setImageBitmap(bm);

Thanks,
Manoj.
On Jun 19, 9:58 am, Sujay Krishna Suresh <[email protected]>
wrote:
> is the uri a content scheme or a http?
>
>
>
>
>
> On Thu, Jun 18, 2009 at 3:23 AM, Aayush <[email protected]> wrote:
>
> > HI,
>
> > I want to display an image from a url, for this I defined the
> > ImageView first as,
>
> > <ImageView
> >   android:id="@+id/imagename"
> >   android:layout_width="wrap_content"
> >   android:layout_height="wrap_content"
> >   />
>
> > then in the activity,
>
> > super.onCreate(savedInstanceState);
> > setContentView(R.layout.main);
> > ImageView imgV = (ImageView)findViewById(R.id.imagename);
>
> > Now how should I supply the url of the image from where it should
> > fetch the image ever time. I have seen the function setImageURI but it
> > is not clear how to give the uri. Any clues?
>
> --
> Regards,
> Sujay
> George Carlin<http://www.brainyquote.com/quotes/authors/g/george_carlin.html>
> - "Electricity is really just organized lightning."
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to