android

[android] URL주소에서 이미지를 가져와 이미지뷰에 보여주기

포카리s 2014. 10. 2. 16:46
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

try{

URL url = new URL("이미지 주소");

URLConnection conn = url.openConnection();

conn.connect();

BufferedInputStream bis = new BufferedInputStream(conn.getInputStream());

Bitmap bm = BitmapFactory.decodeStream(bis);

bis.close();

imgView.setImageBitmap(bm);

}catch(Exception e){

}


※주의!!

퍼미션 <uses-permission android:name="android.permission.INTERNET"/>