YoungCoconutCode YoungCoconutCode - 1 month ago 9
Android Question

When would you save data to the internal cache directory?

I am reading through the Android developer docs on saving data and they mention that when saving a file to internal storage you can use either

. When would it be appropriate to save to the cache directory, and what type of data is best saved here?


Use the cache directory to save temporary files. For example, if you're writing a social app (like instagram) and during runtime the app loads user's pictures, you can store those pictures on the cache directory, so if the user resumes the app while offline, he will still be able to see the last pics.

Make sure to delete each file once it is no longer needed and implement a reasonable size limit for the amount of memory you use at any given time, such as 1MB.