How do I take advantage of Android's "Clear Cache" button

Posted by Jay Askren on Stack Overflow See other posts from Stack Overflow or by Jay Askren
Published on 2010-05-17T12:12:29Z Indexed on 2010/05/22 2:30 UTC
Read the original article Hit count: 327

Filed under:
|
|

In Android's settings, in the "Manage Applications" activity when clicking on an app, the data is broken down into Application, Data, and cache. There is also a button to clear the cache. My app caches audio files and I would like the user to be able to clear the cache using this button. How do I store them so they get lumped in with the cache and the user can clear them? I've tried storing files using both of the following techniques:

newFile = File.createTempFile("mcb", ".mp3", context.getCacheDir());


newFile = new File(context.getCacheDir(), "mcb.mp3");
newFile.createNewFile();

In both cases, these files are listed as Data and not Cache.

© Stack Overflow or respective owner

Related posts about android

Related posts about file-io