2
我想从网络中从某个URL获取图像并将其显示在我的ImageView中。 以下是我使用的代码: -setImageURI/setimagebitmap从网络中获取图像并在图像视图中显示
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);
,但我不能让图像