Novoda ImageLoader - 加载了相同的图像

时间:2012-06-20 17:07:11

标签: android support-image-loader

我正在使用Novoda ImageLoader(https://github.com/novoda/ImageLoader),当我在CursorAdapter中使用此加载程序时,一切都很好。但是当我想在没有任何适配器的情况下使用一个ImageView时,我得到不同URL的相同图像。

//onCreate in Activity   
imageManager = MyApplication.getImageLoader(); 
imageTagFactory = new ImageTagFactory(this, R.drawable.ic_refresh_inverse);
imgView = (ImageView) findViewById(R.id.imgIV);


//fillData - when I finish loading img URL from DB with CursorLoader
imgView.setTag(imageTagFactory.build(imgURL));
imageManager.getLoader().load(imgView);

//code in onCreate Application
LoaderSettings settings = new SettingsBuilder().withDisconnectOnEveryCall(true).withCacheManager(new LruBitmapCache(this)).build(this);
imageManager = new ImageManager(this, settings);

当我查看缓存目录时,会加载不同的图像,但不会使用。 知道哪里可能有问题或如何正确使用这个库只是加载一个图像?
谢谢!

1 个答案:

答案 0 :(得分:1)

这个问题可能类似于https://github.com/novoda/ImageLoader/issues/41 你在网址中有查询参数吗?如果是这样,试着添加这个 设置构建器上的.withEnableQueryInHashGeneration(false)

这是一个错误,它反转了参数enableQueryInHashGeneration背后的逻辑。此参数应在生成图像的hashname时启用/禁用(默认情况下应启用)url的查询部分。当您在URL中将会话令牌作为参数并且您不想一遍又一遍地下载相同的图像时,这非常有用。

问题将在1.5.6版本中解决