I have used universal image loader in my application. It works perfectly. My issue is that my web url remains constant and the image at that url gets changed. So every time it takes image from cache as url is not changed. I want that it should display image from cache initially and in background also update cache and refresh imageview image.
I have tried Universal Image Loader: Can I use cache but also refresh it?.
By using this, it is refreshing imageview but not initially display older image from cache. Instead display place holder image.
You can try something like this
int REPEAT_TIME_IN_SECONDS = 60; //repeat every 60 seconds
Runnable mRunnable;
Handler mHandler = new Handler();
mRunnable = new Runnable() {
@SuppressWarnings("deprecation")
@Override
public void run() {
if (getImageLoader()!=null) {
getImageLoader().getDiscCache().clear();
getImageLoader().getMemoryCache().clear();
}
}
};
mHandler.postDelayed(mRunnable, REPEAT_TIME_IN_SECONDS * 1000);
it will clear your caches at every min and your imageloader will always display latest image. This hack worked for me. Hope it will work for you.