Bitmap imgBitmap = GetImageFromURL("https://t1.daumcdn.net/cfile/tistory/112CA2274C2220D2B4");

if (imgBitmap != null) { ImageView imgView = (ImageView)findViewById(R.id.ImageView); imgView.setImageBitmap(imgBitmap);
 }




private Bitmap GetImageFromURL(String strImageURL) { Bitmap imgBitmap = null; try { URL url = new URL(strImageURL); URLConnection conn = url.openConnection(); conn.connect(); int nSize = conn.getContentLength(); BufferedInputStream bis = new BufferedInputStream(conn.getInputStream(), nSize); imgBitmap = BitmapFactory.decodeStream(bis); bis.close(); } catch (Exception e) { e.printStackTrace(); } return imgBitmap; }

 
Posted by 예배하는 프로그래머

댓글을 달아 주세요