I have an image URL. I want to display an image from this URL in an ImageView but I am unable to do that.
How can this be achieved?
There is two way :
1) Using Glide library This is best way to load image from url because when you try to display same url in second time it will display from catch so improve app performance
Glide.with(context).load("YourUrl").into(imageView);
dependency : implementation 'com.github.bumptech.glide:glide:4.10.0'
2) Using Stream. Here you want to create bitmap from url image
URL url = new URL("YourUrl");
Bitmap bitmap = BitmapFactory.decodeStream(url.openConnection().getInputStream());
imageView.setImageBitmap(bitmap);