San*_*air 2 java android android-glide
我正在使用滑动库来显示图像.我试图通过使用以下代码清除滑动缓存:
Glide.get(MainActivity.this).clearDiskCache();
Glide.get(MainActivity.this).clearMemory();
Run Code Online (Sandbox Code Playgroud)
上面的代码在Async中,我在Do背景部分调用.
当我运行这个时,我总是得到:
Caused by: java.lang.IllegalArgumentException: You must call this method on the main thread
at com.bumptech.glide.util.Util.assertMainThread(Util.java:135)
at com.bumptech.glide.Glide.clearMemory(Glide.java:370)
Run Code Online (Sandbox Code Playgroud)
这可能有什么问题?如果我在MainThread中使用上面的内容,则要求在后台运行它.
如何清除缓存?
谢谢!
| 归档时间: |
|
| 查看次数: |
4200 次 |
| 最近记录: |