안드로이드 개발 질문/답변
(글 수 45,052)
private Bitmap imageUrl(String Url){
Bitmap bm = null;
URL imageURL;
try {
Log.i("imageURL", Url);
imageURL = new URL(Url);
HttpURLConnection conn = (HttpURLConnection)imageURL.openConnection();
BufferedInputStream bis = new BufferedInputStream(conn.getInputStream(), 10240);
bm = BitmapFactory.decodeStream(bis);
bis.close();
} catch (MalformedURLException e) {
Log.i("MalformedURLException", e.toString());
e.printStackTrace();
} catch (IOException e) {
Log.i("IOException", e.toString());
// TODO Auto-generated catch block
e.printStackTrace();
}
return bm;
}
이렇게 하면 이미지를 읽어 올 경우가 있고 읽어 오지 못할경우가 있는데요
이런건 어떻게 처리 해야되나요?
Bitmap bm = null;
URL imageURL;
try {
Log.i("imageURL", Url);
imageURL = new URL(Url);
HttpURLConnection conn = (HttpURLConnection)imageURL.openConnection();
BufferedInputStream bis = new BufferedInputStream(conn.getInputStream(), 10240);
bm = BitmapFactory.decodeStream(bis);
bis.close();
} catch (MalformedURLException e) {
Log.i("MalformedURLException", e.toString());
e.printStackTrace();
} catch (IOException e) {
Log.i("IOException", e.toString());
// TODO Auto-generated catch block
e.printStackTrace();
}
return bm;
}
이렇게 하면 이미지를 읽어 올 경우가 있고 읽어 오지 못할경우가 있는데요
이런건 어떻게 처리 해야되나요?