setImageURI / setimagebitmap to fetch image from net and display in image view
I want to fetch image from net from some URL and show it in my ImageView. following is the code i am using :- Bitmap bm = null; try { URL aURL = new URL("stringURL"); URLConnection conn = aURL.openConnection(); conn.connect(); InputStream is = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); bm = BitmapFactory.decodeStream(bis); bis.close(); is.close(); }catch (Exception e) { // TODO: handle exception } iv.setImageBitmap(bm); but i can not get the image I think the error is in URL aURL = new URL("stringURL"); should be without quotes URL aURL = new URL(stringURL);