I'm using MaterialDrawer library and loading profile images with Picasso. But I am unable to save it locally with Picasso and loading it from cache in the future.
Before creating the drawer,
//below line is for loading profile image from url
DrawerImageLoader.init(new DrawerImageLoader.IDrawerImageLoader() {
@Override
public void set(ImageView imageView, Uri uri, Drawable placeholder) {
Picasso.with(imageView.getContext()).load(uri).placeholder(placeholder).into(imageView);
}
@Override
public void cancel(ImageView imageView) {
Picasso.with(imageView.getContext()).cancelRequest(imageView);
}
@Override
public Drawable placeholder(Context ctx) {
return null;
}
});
I wrote this as material library says. Then I set my profile picture:
String myURL = "http://www.american.edu/uploads/profiles/large/chris_palmer_profile_11.jpg"
profile = new ProfileDrawerItem().withName(person.getFullName()).withEmail(person.getStMajorName()).withIcon(myURL)
But everytime I run the app, it loads it from the internet.
How can I cache the image?