Convert Image URL String into Bitmap Resource

Convert Image URL String into Bitmap Resource

While working with the Android Studio, if you want to convert or display an image that is currently in String URL form, then we can do this as follow:

1. First Declare the widgets as
 
ImageView img;
Bitmap bitmap;

2. Initialization of the Widget as
 
img = findViewById(R.id.img);
 
3. Write this code outside the onCreate() method of the Activity file.
  


4. Now use the Above Code under the Button OnClick() Listener using this:

String path="https://Any Image URL";
new GetImageFromUrl(img).execute(path)
 
 
 
 
 
 









GIVE FEEDBACK ()