0

I use Picasso (version 2.5.2) in my Android project. I know it uses cache when downloading images from the internet. Now I'm wondering if I should implement images downloading mechanism or Picasso's cache is enough? I'm talking about couple hundreds (about 400) of small images (up to 200Kb).

ostojan
  • 608
  • 1
  • 7
  • 17
  • When do you need to use these images? Is the app required to work offline? Does the set of images ever change? Without specifying the product requirements of your app, it's impossible to answer this question. – Eric O'Connell Apr 11 '17 at 19:14
  • Images are used as item backgrounds in RecyclerView in main activity of my app. I want that app could work offline. Images won't change but there can be more of them in future. – ostojan Apr 11 '17 at 19:21

1 Answers1

1

From the ever-helpful FutureStudio (https://futurestud.io/tutorials/picasso-influencing-image-caching):

The default disk cache is:

  • Disk cache of 2% storage space up to 50MB but no less than 5MB. (Note: this is only available on API 14+ or if you are using a standalone library that provides a disk cache on all API levels like OkHttp)

So, the answer is: it depends. You can change the disk cache to be larger, as per https://stackoverflow.com/a/30707305/4021735, but only to a predefined limit. So, depending on a) how important it is for the images to be visible b) your ability to predict the future, you may be able to specify a large limit (say, 100MB? 200MB?) and be ok. However, if you can't guarantee a limit on the size of all active images, you will need to implement your own downloader to guarantee they are available.

Community
  • 1
  • 1
Eric O'Connell
  • 858
  • 5
  • 14