Android ImageLoader显示图像功能的快速查询
我对Universal Image Loader库中的函数DisplayImage有一个问题。如果我有一个类似“www.myexample.com/image.jpg”的url,然后说:Android ImageLoader显示图像功能的快速查询,android,universal-image-loader,Android,Universal Image Loader,我对Universal Image Loader库中的函数DisplayImage有一个问题。如果我有一个类似“www.myexample.com/image.jpg”的url,然后说: DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder() .cacheInMemory(true) .build(); ImageLoaderConfiguration config = new ImageLoa
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.defaultDisplayImageOptions(defaultOptions)
.build();
ImageLoader.init(config);
String url= "www.myexample.com/image.jpg";
ImageLoader.getInstance().DisplayImage(url, imageviewexpample);
我有以下问题:
cacheInMemory(true)
)图像将保存在内存缓存中。UIL还可以将它们保存到设备的外部存储器中以“缓存”它们。
我认为缓存的大小是有限的,因此您可能无法得到保证
每个图像都被缓存,但这只是猜测。见3非常感谢你。但是关于第一个问题:图像将保存在缓存中,这是肯定的,但是下次使用相同的url调用“DisplayImage”函数时,图像将从internet或缓存中检索吗?,这就是我在谷歌或操作系统中找不到答案的原因,因此我想知道是否应该阅读源代码。@LuisE缓存就是为了不必反复从internet加载图像,所以一般来说:是的,它将从缓存而不是internet加载。这在术语“缓存”中有点含蓄。谢谢,现在我知道它将从缓存中存储,如果它还不存在,则从缓存中加载。我很困惑,因为我使用的是来自互联网的URL,所以我猜每次都会从那里检索到,但现在我知道ImageLoader库足够智能,可以先检查缓存,然后获取图像,其中的键是基于URL的代码。