ImageView imageView=(ImageView)findViewById(R.id.selectedImage);
imageView.setImageBitmap(loadImageFromWeb(string));
public Bitmap loadImageFromWeb(String imgUrl) {
Bitmap bmp;
try {
URL url = new URL(imgUrl);
Object content = url.getContent();
InputStream is = (InputStream) content;
bmp = BitmapFactory.decodeStream(is);
} catch (OutOfMemoryError oumEx) {
Log.e("IMAGE SIZE TOO LARGE", "For->" + imgUrl);
bmp = null;
} catch (IOException ioex) {
Log.e("SOME PROBLEM WITH IMAGE", "For->" + imgUrl);
bmp = null;
}
return bmp;
}
No comments:
Post a Comment