diff options
-rw-r--r-- | src/github/daneren2005/dsub/activity/SettingsActivity.java | 1 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/util/FileUtil.java | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/activity/SettingsActivity.java b/src/github/daneren2005/dsub/activity/SettingsActivity.java index f8fed602..1807237c 100644 --- a/src/github/daneren2005/dsub/activity/SettingsActivity.java +++ b/src/github/daneren2005/dsub/activity/SettingsActivity.java @@ -125,6 +125,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer @Override protected Void doInBackground() throws Throwable { FileUtil.deleteMusicDirectory(SettingsActivity.this); + FileUtil.deleteSerializedCache(SettingsActivity.this); return null; } diff --git a/src/github/daneren2005/dsub/util/FileUtil.java b/src/github/daneren2005/dsub/util/FileUtil.java index 2c717416..852fc2ab 100644 --- a/src/github/daneren2005/dsub/util/FileUtil.java +++ b/src/github/daneren2005/dsub/util/FileUtil.java @@ -22,6 +22,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; +import java.io.FilenameFilter; import java.io.RandomAccessFile; import java.io.Serializable; import java.util.Arrays; @@ -228,6 +229,13 @@ public class FileUtil { File musicDirectory = FileUtil.getMusicDirectory(context); return Util.recursiveDelete(musicDirectory); } + public static void deleteSerializedCache(Context context) { + for(File file: context.getCacheDir().listFiles()) { + if(file.getName().indexOf(".ser") != -1) { + file.delete(); + } + } + } public static boolean ensureDirectoryExistsAndIsReadWritable(File dir) { if (dir == null) { |