2
私は画像を表示するためにGlideライブラリを使用しています。画像が消去されないようにdiskCacheStrategy(DiskCacheStrategy.Source)を設定しました。プロファイルの画像を更新すると、画像が更新されません。 clearDiskCacheとGlide.clearMemory())。それでは、どのように、より良く理解グライドを使って画像を強制的にリフレッシュする方法は?
if(!getBoolValueForProfilePicUploading())
{ glide.with(context).load(imgData.url).asBitmap().centerCrop().diskCacheStrategy(DiskCacheStrategy.SOURCE).placeholder(R.drawable.default_profilepic).error(R.drawable.default_profilepic).into(new BitmapImageViewTarget(userImageView) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(context.getResources(), resource);
circularBitmapDrawable.setCircular(true);
userImageView.setImageDrawable(circularBitmapDrawable);
}
});
}else
{
new LongOperation(context,imgData,userImageView).execute();
}
これはasynctask背景()のためであるために以下のコードを参照しなさいインスタンスをクリアせずに画像をリフレッシュ強制的に
protected String doInBackground(String... params) {
try
{
Glide.get(context).clearDiskCache();
Glide.get(context).clearMemory();
}catch (Exception e)
{
e.printStackTrace();
}
return null;
}
あなたは 'skipMemoryCache()'を試しましたか? –
いいえ。返信いただきありがとうございます。私は確認してからuに戻ります。 – Ajay
メソッドのクラス名は何ですか – Ajay