android - Universal Image Loader: I get ConcurrentModificationException when trying to remove image from cache -


i need arbitrarily replace cached image requesting again server.

i'm using removefromcache follows:

public void loadimage(string url, imageview view, boolean updatecache){     if(updatecache){         memorycacheutil.removefromcache(url, imageloader.getinstance().getmemorycache());     }     imageloader.getinstance().displayimage(url, view); } 

the problem throws concurrentmodificationexception.

what's best way it?

  • can synchronize call remove on collection used internally in library somehow?
  • does library give me way tell want "cache miss" 1 image arbitrarily?

uil version 1.8.4

stack trace:

fatal exception: main java.util.concurrentmodificationexception @ java.util.linkedhashmap$linkedhashiterator.nextentry(linkedhashmap.java:350) @ java.util.linkedhashmap$keyiterator.next(linkedhashmap.java:370) @ java.util.hashset.(hashset.java:76) @ com.nostra13.universalimageloader.cache.memory.impl.lrumemorycache.keys(lrumemorycache.java:124) @ com.nostra13.universalimageloader.core.assist.memorycacheutil.removefromcache(memorycacheutil.java:102) @ uk.frequency.glance.android.util.imageloadingmanager.loadimage(imageloadingmanager.java:120)

this known bug: https://github.com/nostra13/android-universal-image-loader/issues/265

fixed in uil v1.8.5.


Comments