Glide loads the old image

Ime*_*ene 5 android file android-glide

I have a problem that each time , I take a photo and and I try to display it. Glide load me the old file. I check the file locally , it has been changed successfully. But the old image is displayed.

This is my code :

  public void onCameraCaptureCompleted(final File photoFile) {
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                stopCamera();
                pickedImg.setImageBitmap(null);
                Glide.with(TakePhotoFragment.this)
                        .load(photoFile)
                        .asBitmap()
                        .dontAnimate()
                        .diskCacheStrategy(DiskCacheStrategy.NONE)
                        .into(pickedImg);
            }
        });

    }
Run Code Online (Sandbox Code Playgroud)

Who knows how to solve this problem ?

Int*_*iya 5

试试 skipMemoryCache

允许加载的资源跳过内存缓存。

.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)   
Run Code Online (Sandbox Code Playgroud)

笔记

如果仍然出现同样的问题,则使用clearMemory(). 对于好的方法,创建应用程序类并添加这个

public class RootApplication extends Application 
{
   @Override public void onLowMemory() {
    super.onLowMemory();
    Glide.get(this).clearMemory();
}
Run Code Online (Sandbox Code Playgroud)

确保,添加了这个应用Manifest

<application
    android:name=".RootApplication"
 >
Run Code Online (Sandbox Code Playgroud)