Reputation: 1651
What is the best way of caching Bitmaps if my min sdk is api lvl 8? I have a downloaded Bitmap which I would like to save, I can also get a type of hash for the image. Is it OK to just write it to a normal file anywhere if i fix the permissions, say like this?
FileOutputStream fOut = new FileOutputStream(file);
bmp.compress(Bitmap.CompressFormat.PNG, 85, fOut);
Upvotes: 0
Views: 1291
Reputation: 3249
I think you should use Universal Image Loader library. It will do the caching, loading from url and other things by itself.
Upvotes: 0
Reputation: 6268
One of the best way to download and cache images is use Volley library. It's really easy and comfortable. There are a lot of different examples in the Internet but at first I suggest you to watch IO video . And then look for code examples (BitmapLruCache
- is used directly for caching) (e.g. here or here)
Upvotes: 1