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 dele
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:
try {
FileUtils.deleteDirectory(context.getCacheDir());
} catch (IOException e) {
Log.e(LOGTAG,"Error deleting cache dir", e);
}
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).