I'm loading images from URLs (http://) with Picasso.
Sometimes when i try to "preload" an image using Picasso's fetch()
method, the image doesn't get cached. I guess it's because it's size is too big.
Read the answer for this question, but setCache()
doesn't seem to be recognized for me, i don't even find it in the Picasso documentation.
Is there any way to change the cache size Picasso uses for bitmaps?
This example use OkHttp as http client for Picasso and setup max Disk cache size and also memory cache.
You can do:
Picasso
uses aCache
interface type to manage the cache. They provide the default implementation,LruCache
, which has a constructor that accepts the max size in bytes as an argument.Seems like the other answer uses the wrong function. It should be
memoryCache
, notsetCache
.