Hi ,

I have an issue when loading an image from remote location.

For this I am using UrlConnection to connect and getting the
InputStream .

my code snippet is as follows:

public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        ImageView i = new ImageView(this);
         i.setImageBitmap(getView("http://www.precentral.net/sites/
androidcentral.com/files/wp-migrate/2008/09/android-sdk.jpg"));
          setContentView(i);
    }

    public Bitmap getView(String myImageURL)
    {
         Bitmap bm = null;
         try {
                   URL aURL = new URL(myImageURL);
                   URLConnection conn = aURL.openConnection();
                   conn.connect();
                   InputStream is = conn.getInputStream();

                    BufferedInputStream bis = new BufferedInputStream(is );
                    bm = BitmapFactory.decodeStream(bis);

                          is.close();
                           bis.close();


              } catch (IOException e)
                   {
                     Log.e("DEBUGTAG", "Remtoe Image Exception", e);
                     }


           return bm;
       }



I don't know whats wrong with my code. But the image  is not
displayed. Nor  the Exception.
Can any one suggest me whats the problem.

Thanks in advance.


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

Reply via email to