Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import java.io.File; public class Main { public static void cleanInternalCache(Context context) { deleteFilesByDirectory(context.getCacheDir()); } private static void deleteFilesByDirectory(File directory) { if (directory != null && directory.exists() && directory.isDirectory()) { for (File item : directory.listFiles()) { if (item.isDirectory()) { deleteFilesByDirectory(item); } item.delete(); } directory.delete(); } } }