2

I have a DB that stores the paths of the photo. In my application I show this photo with Glide library.

The paths are:

http://www.mysite.example/username/0.jpg  
http://www.mysite.example/username/1.jpg  

But I have a problem when I delete the row on the DB table, the path of the photo restarts from 0 and when I show the photos with Glide, it shows me the photo that was stored before.

How do I fix this problem? Clear cache?

This is a snippet of the code

@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;
    }
Zoe
  • 27,060
  • 21
  • 118
  • 148
  • Check out their documentation on caching, maybe it will help you. - https://github.com/bumptech/glide/wiki/Caching-and-Cache-Invalidation – Dayan Jun 30 '17 at 15:12

1 Answers1

0

it is better to use hash name for your image name in server side. so the url nearly never be same .

faraz khonsari
  • 1,924
  • 1
  • 19
  • 27