I am trying to understand Volley\'s image caching. I have a fragment with gridview inside it, which will load around 12-30 images. There images are retrieved from server and
Consider using Glide which android recommends for loading images in your app. Compared to volley, Glide provides automatic image caching.
To add Glide in your app:
Step 1 ) Update build.gradle file
dependencies {
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support:support-v4:19.1.0'
}
Step 2) Add INTERNET permission in manifest file
Step 3) Add ImageView in you layout
Step 4) Glide Usage in Activity
//Initialize ImageView
ImageView imageView = (ImageView) findViewById(R.id.imageView);
//Loading image from below url into imageView
Glide.with(this)
.load("IMAGE URL HERE")
.placeholder(R.drawable.placeholder)
.error(R.drawable.imagenotfound)
.override(200, 200);
.centerCrop();
.into(imageView);
Read more on Android Glide Library