我有一個存儲照片路徑的Db。 在我的應用程序中,我用Glide
庫展示了這張照片。
滑動庫給我看錯圖片
的路徑是:
hhtp://www.mysite.example/username/0.jpg
hhtp://www.mysite.example/username/1.jpg
但是我有一個問題,當我從0
刪除數據庫表中的行,照片重啓的路徑,當我顯示出與滑行的照片,它向我顯示之前存儲的照片。
我該如何解決這個問題?清除緩存?
這是代碼
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
ImageView imageView;
if (v == null) {
v = inflater.inflate(R.layout.gridview_item, parent, false);
v.setTag(R.id.picture, v.findViewById(R.id.picture));
}
imageView = (ImageView) v.getTag(R.id.picture);
Glide.with(context).load(path.get(position).getPath()).into(imageView);
return v;
}
查看他們關於緩存的文檔,也許它會幫助你。 - https://github.com/bumptech/glide/wiki/Caching-and-Cache-Invalidation – Dayan