How to change or update an image of an ImageView already loaded with Glide? [duplicate]


I have a Activity that loads the profile image of the user using Glide perfectly, the problem comes when the user selects an image from their gallery. When I receive the image with ActivityForResult , I charge the new profile image to ImageView using the property .setImageUri() so that I can see its new image and then upload it, but the problem is that it is not updated, the loaded image follows with Glide .

What can I do to delete the image loaded with Glide and put the other one in the gallery?

PD: Use the Glide.clear() property but it did not work.

asked by Rosyec Parrado 20.07.2018 в 01:03

1 answer


What happens is that the image's cache is being loaded for that reason it is not updated.

You comment that you use the property:


but it does not work, the reason is that this method only cleans the content of ImageView and not the cache.

You must use the skipMemoryCache (true) method with the value of true, however this method works if not you previously cached an image.

The method that would always work is adding a different signature using the method signature () :

.signature(new StringSignature(UUID.randomUUID().toString())).into(myImageView);
answered by 20.07.2018 / 02:37