0

Both of above is related. Following is my case

  1. I am using Volley Library
  2. Picasso(2.3.2) to load images
  3. Images are fairly large,so I resize them to dimension 300x300
  4. But during scroll of ListView/GridView, the images are reloaded again. Though the reload time is fairly small, I do not want the reloading of such nature.

So browsing, net I came across following

  1. Use OkHttpClient caching mechanism

    How to implement my own disk cache with picasso library - Android?

  2. So I tried using OkHttp 2.0.0 into Volley Library

    https://gist.github.com/JakeWharton/5616899

    I think , from OkHttp 2.0.0 there is something to be changed on above gist. So I followed this instead

    How to implement Android Volley with OkHttp 2.0?

  3. But the Volley library won't function now using method 2. Finally, I am trying to use caching as mentioned on this

    https://gist.github.com/ceram1/8254f7a68d81172c1669

So, my question is fairly simple, how not to reload the images that has been already downloaded. And if ,I have to use OkHttp 2.0.0 for disk caching, what are the ways, I should follow.

Community
  • 1
  • 1
laaptu
  • 2,963
  • 5
  • 30
  • 49

1 Answers1

0

Stay with flow of how cache should work. Don't know Picasso cause I use Aquery, but they should use pretty much same flow whenever a bitmap(bm) needs to 'load' in some image view.

Flow:

If bm is thumb do chekthm

If bm large do cheklarge

On thmb:

If in memcache return bm for load to view

If in filecache return bm from there

In temp bm still null do network fetch to return bm , with loads to respective caches and with 'ejects' 4 onFullCache.

For large bm , use same flow like thmb only config cache holds not as many entries.

Nowhere in there do you have to prevent a fetch . why because the process Only arrives at choice of network fetch when the bm Not avail from local options. At that point u either use default drawible from local res ( not correct bm for your logic) or you must do network fetch.

Robert Rowntree
  • 6,230
  • 2
  • 24
  • 43
  • That is the flow,I am going to use. But for that ,I need to implement the disk cache using Picasso,Volley and OkHttp. Since with OkHttp2.0,I am not being able to integrate with Volley. – laaptu Jul 08 '14 at 08:59