Home » Java » Android -get image from URL without being saved to storage

Android -get image from URL without being saved to storage

Posted by: admin June 30, 2018 Leave a comment

Questions:

I get a image from a server an I want to display it in my Adapter.

Even if i use URL with Glide or if I use the conversion URL->BITMAP->URI,
the image gets saved in gallery.How can i get it displayed without being saved?
Or how can i save it as nomedia and then use it with Glide/Picasso?

public Uri getImageUri(Context inContext, Bitmap inImage) {
  ByteArrayOutputStream bytes = new ByteArrayOutputStream();
  inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
  String path = Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null);
  return Uri.parse(path);
} 
Answers: