Do you have the <uses-permission
android:name="android.permission.INTERNET"></uses-permission> declared
in your AndroidManifest.xml file ?

I can see an ImageView in my Emulator with your snapshot of the
Emulator that you have up on your website :)

Balwinder Kaur
Open Source Development Center
·T· · ·Mobile· stick together

The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.


On Jul 20, 3:32 am, santu <[email protected]> wrote:
> 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 [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