Captcha image cannot be updated with Glide

I tried using Glide to load a Captcha image into an ImageView. The first time the download is beautiful. However, when I load a Captcha image into the same ImageView, the ImageView does not update to a new image. Does anyone know how to solve this problem?

String url = "https://captcha_path";
ImageView imgView = (ImageView)getActivity().findViewById(R.id.imgView);

Glide.with(getActivity()).load(url).asBitmap().diskCacheStrategy(DiskCacheStrategy.NONE).into(imgView);
+3
source share
2 answers

Glide.clear(), Glide.with(...). load(). URL , .skipMemoryCache(true) . .signature() API. - :

Glide.with(fragment)
    .load(url)
    .signature(new StringSignature(UUID.randomUUID().toString()))
    .into(imgView);
+14
Glide.with(fragment)
    .load(url)
    .signature(new StringSignature(UUID.randomUUID().toString()))
    .into(imgView);

StringSignature ObjectKey ( Glide v4)

Glide.with(fragment)
        .load(url)
        .signature(new ObjectKey(UUID.randomUUID().toString()))
        .into(imgView);
0

Source: https://habr.com/ru/post/1667331/


All Articles