How can I display image in an ImageView
in android from a URL (from the internet)?
Official Google apps are also using Glide. Glide is an Image Loader Library in Android developed by bumptech and is a library that is backed by Google.
You can use the method setImageDrawable
ImageView iv = new ImageView;
URL url = new URL(address);
InputStream content = (InputStream)url.getContent();
Drawable d = Drawable.createFromStream(content , "src");
iv.setImageDrawable(d)
[2014-12-16] Edit: Using Picasso, makes your life much simplier
String url = "http://i.imgur.com/bIRGzVO.jpg";
ImageView iv = new ImageView;
Picasso.with(context).load(url).into(iv);
//Picasso.with(context).load(url).centerCrop().fit().into(iv);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With