I have done it, but it doesn't work.

my bitmap is always NULL :(
this is my code:

private Bitmap getRemoteImage(URL url) {
        try {
             URLConnection conn = url.openConnection();
             conn.connect();
             BufferedInputStream bis = new
BufferedInputStream(conn.getInputStream());
             Bitmap bm = BitmapFactory.decodeStream(bis);
             bis.close();
             if(bm == null)
                 Log.d("DEBUG", "NULLLLLLLLLLLL");
             return bm;
        } catch (IOException e) {
             Log.d("DEBUG", "Errore: Impossibile recuperare
l'immagine");
        }

        return null;
   }

I have tried also with openStream(), but it's the same problem.

Please, help me. Thanks.

On 5 Mar, 05:46, Nithin <nithin.war...@gmail.com> wrote:
> Convert the image from URL to Bitmap.
> Then use setImageBitmap().
>
> On Mar 5, 4:41 am, Paolo <brand...@gmail.com> wrote:
>
>
>
> > I have to insert, at runtime, an image in an ImageView.
> > I haven't it in local, but i can get it from an URL.
>
> > Anybody has an idea about how could I do itt?

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