I read through the Android documentation of the cache (see Data Storage Documentation) but I didn't got how I can clean the whole folder.
So how can I delete the cache-folder of my app? It's in this path:
/Android/data/de.stepforward/cache/
I read through the Android documentation of the cache (see Data Storage Documentation) but I didn't got how I can clean the whole folder.
So how can I delete the cache-folder of my app? It's in this path:
/Android/data/de.stepforward/cache/
Rather than rolling your own utility methods, you may want to consider using the apache commons FileUtils library. It contains a lot of useful File manipulation methods and makes operations like this very trivial.
Here are the JavaDocs
And here is an example:
Alternately, rather than deleting the whole cache directory, you may want to create subdirectories within the app's cache directory for specific data. Than you can delete those specific directories when required (e.g. on user logout).
Put this code in onDestroy() to clear app cache:
You can use the code referenced here:
https://stackoverflow.com/a/7600257/327011
From the documentation:
Create a method to recurse through the folder and delete them, if that's what you want to do.