Reputation: 5792
I am using picasso
plugin to load image.
Picasso.with(context).load(BackendConfig.media_url+folder+holder.media_name).resize(150, 150).into(holder.imageView);
It's working fine. But, I want to save that image in SD card by loading just once from URL
.
How can I do that?
Upvotes: 1
Views: 736
Reputation: 557
you can use this lightweight android library VINCI (wrot this for my self) its do every thing you want
LruCache
files/bitmaps
(Saving files in internalStorage)read this WIKI part for more visit my github repo .
Storage store = Vinci.base(context).process().load(uri).file();
Log.e("Created", Boolean.toString(store.isCreated()));
Log.e("FileObject", store.FileObject().toString());
Log.e("FullPath", store.getfullPath().getPath());
Log.e("LocalPath", store.LocalPath());
Log.e("Get Bitmap File", String.valueOf(store.getBitmap()));
Upvotes: 1
Reputation: 2976
Picasso using LRU disk cache, no need to worry about loading it from URL once. If you need to load and save actual image as file, load it as bitmap resource instead, and use Bitmap.compress and FileOutputStream to save into file (PNG/JPEG/WEBP).
Upvotes: 1