I have implemented a RecyclerView that contains mainly images which is loading in through Picasso. My problem is that as soon as I scroll down or up the view, the placeholde
Picasso automatically cache images in two levels:
They are bot initialized with defaults that suites most applications.
When the memory cache is getting too big the oldest used bitmap is removed from memory cache (which by default is 1/7 of the available heap space).
I think what's happening here is that you are close to the memory limit of the cache and thus images are decoded again every time you need them again.
See here: Android Picasso Configure LruCache Size
But I advice AGAINST increasing the memory cache size unless you really are re-sizing the images to the actual size you use..
I think the problem with your code is this:
.resize(deviceWidth, deviceWidth)
are you sure you really need an image of that size? What do you store in PrefUtils ? does it get updated when the device rotate? (landscape vs portrait)
If you need smaller images try to pass the resize the actual size of the image you are gonna use. If you don't know (computed at runtime with the layout) do with an approximation or write your code to obtain the actual size (I usually write custom classes extending ImageView for these stuff).
If you really need the images at that size just increase the cache size (see link above) and you should be good to go.