I have a problem in loading image using glide. I am trying to load an image after picking image from gallery, when I tried to load an image using Android Default setImageBitmap(bitmap);
It's worked but I faced memory leak issue.
Then I tried Glide image loader to avoid memory leak issue. But I can't load image using File Path.
Glide.with(_A)
.load(new File(uri.getPath()))
.asBitmap()
.override(w, w)
.centerCrop()
.placeholder(R.drawable.diploma)
.diskCacheStrategy(DiskCacheStrategy.SOURCE).into(imageView);
I also tried to load Uri but that too doesn't worked.
Then I tried to load image from URL Glide loaded URL image. That worked perfectly.
Glide
.with(_A)
.load("https://yt3.ggpht.com/-v0soe-ievYE/AAAAAAAAAAI/AAAAAAAAAAA/OixOH_h84Po/s900-c-k-no-mo-rj-c0xffffff/photo.jpg")
.asBitmap()
.override(w, w)
.centerCrop()
.placeholder(R.drawable.diploma)
.diskCacheStrategy(DiskCacheStrategy.SOURCE).into(imageView);
Then I tried Default function to load image from Uri
imageView.setImageURI(uri);
This function worked Image loaded.
Uri doesn't have an Issue, Then why I can't load an image?
Can anyone help me to find the solution to fix this issue ?