I 've just started use Picasso in Android, and I have a problem with it that I realize when Picasso load too many Image make it out of memory and the previous loaded images will be remove from memory, so when i come back Picasso will load from internet again. I just want to make some important images will always in the memory, like Profile Picture. Should I storage image in disk memory or use another library or something else.Can someone guide me the solution?
Asked
Active
Viewed 368 times
0
-
Have u check this https://stackoverflow.com/questions/23978828/how-do-i-use-disk-caching-in-picasso – AskNilesh Aug 23 '18 at 06:23
-
yes, i have checked, I try it but it doesn't work – manhtuan21 Aug 23 '18 at 06:26
-
I don't know what Picasso is doing, but Glide for example is also using a disk cache for the images it loads. – Henry Aug 23 '18 at 06:26
-
1Try loading the image using glide. It has two level of caching disk caching and memory cache. Image will load from memory cache if there is no value in memory cache means it will load from disk cache . – Nagendra Hari Karthick Aug 23 '18 at 06:34
1 Answers
1
You can Glide
for your requirement , Its a powerful image loading library
In your app gradle do this
repositories {
mavenCentral()
google()
}
dependencies {
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}
Usage:-
Glide.with(context)
.load(url_here)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(holder.imageView);
This is the key DiskCacheStrategy.ALL
which caches all versions of the image

Quick learner
- 10,632
- 4
- 45
- 55