I'm using Universal Image Loader to display images in my app in listviews. I'm using UnlimitedDiscCache
since this is the fastest cache mechanism according to the documentation.
However, I would like to clear the disc cache when my app is closed (e.g. in onStop()
) but only the oldest cached files that exceed a given limit should be deleted (like TotalSizeLimitedDiscCache
does).
I am aware of ImageLoader.clearDiscCache()
but in my case this clears the complete cache since I am using UnlimitedDiscCache
before...
So I would like to have the fastest cache mechanism when the user is loading and scrolling the listviews and do the slow cache clear when the user is no longer interacting with the app.
Any ideas how I can achieve this?
onStop()
is called. That only says that the current activity is being stopped. The performance loss is very minimal when compared to time spent implementing another caching mechanism (which may slow down the app anyways). – Daffiif(isFinishing()) { do something}
– SailorisFinishing()
only tells you that the current activity is stopping, not the app. If you are only using oneActivity
sure, but otherwise you will have issues. – Daffi