Captcha image cannot be refresh by using Glide

后端 未结 2 573
闹比i
闹比i 2021-01-06 02:55

I have tried to use Glide to load an Captcha image into a ImageView. The first time loading is fine. However, when I reload the Captcha image into the same ImageView, the Im

相关标签:
2条回答
  • 2021-01-06 03:18

    You can always use Glide.clear() and then call Glide.with(...).load() again. If your url doesn't change when the image changes, you may also need to add .skipMemoryCache(true) to your load call. For more control, check out the .signature() API. You can always do something like:

    Glide.with(fragment)
        .load(url)
        .signature(new StringSignature(UUID.randomUUID().toString()))
        .into(imgView);
    
    0 讨论(0)
  • 2021-01-06 03:20
    Glide.with(fragment)
        .load(url)
        .signature(new StringSignature(UUID.randomUUID().toString()))
        .into(imgView);
    

    Replace StringSignature with ObjectKey (for Glide v4)

    Glide.with(fragment)
            .load(url)
            .signature(new ObjectKey(UUID.randomUUID().toString()))
            .into(imgView);
    
    0 讨论(0)
提交回复
热议问题