Title: ViewPager Glide
Tags: android;android-viewpager;android-glide
Question: I have ViewPager(Slide) and have 3 image. There are three images that are downloaded over the Internet. If I change the picture to another server on the server, the link remains the same, but the picture in the application does not change and remains the same one that was in the cache

```public class ViewPagerAdapter extends PagerAdapter {

    private Context context;
    private LayoutInflater layoutInflater;
    private String [] image = {"http://rgho.st/7hDcbyT2F/image.png",
            "http://guid-korenovsk.my1.ru/logos.png",
            "https://4.bp.blogspot.com/-JKogH2VCCoY/V_aZWCFsmtI/AAAAAAAABAA/Lu6D13VXGSMMnYFO8T8-pKDeqbkHhNRAwCLcB/s320/VideoThumbail.PNG"};



    public ViewPagerAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getCount() {
        return image.length;
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
       layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = layoutInflater.inflate(R.layout.bulding_layout, null);
        ImageView imageView = (ImageView)view.findViewById(R.id.imageViewPager);

        Glide.with(context)
                .load(image[position])
                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .into(imageView);







        ViewPager vp = (ViewPager)container;
        vp.addView(view,0);
        return view;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        ViewPager vp = (ViewPager)container;
        View view = (View)object;
        vp.removeView(view);
    }

}

 public class MyTimerTask extends TimerTask {

        @Override
        public void run() {
           getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    if(viewPagerAds.getCurrentItem() == 0){
                        viewPagerAds.setCurrentItem(1);
                    }else if(viewPagerAds.getCurrentItem() == 1){
                        viewPagerAds.setCurrentItem(2);
                    }else viewPagerAds.setCurrentItem(0);
                }
            });
        }
    }
```



Here is another answer: You can use ```DiskCacheStrategy.NONE``` on this ```Glide``` instance to avoid the caching of the image. In this case, ```Glide``` will download the image again everytime. To have a more optimized version, you have to check the method ```signature()``` and use a custom signature when the server invalidates its data.
Link to ```Glide``` wiki about cache invalidation: https://github.com/bumptech/glide/wiki/Caching-and-Cache-Invalidation


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2017:00:04/22/17', 'FavoriteCount': 0.0, 'PostTypeId': 1, 'Tags': '<android><android-viewpager><android-glide>', 'Title': 'ViewPager Glide', 'ViewCount': 3914, 'id': 43561327, 'user_AboutMe': None, 'user_AccountId': 6749223.0, 'user_DisplayName': 'Imperator', 'user_Reputation': 11.0, 'user_Views': 8.0, 'user_id': 5199822.0}}