Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import java.io.File; public class Main { public static Context sAppContext; /** * Clear the cache directory. * * @return whether the cache directory is cleared. */ public static boolean clearCache() { File[] files = sAppContext.getCacheDir().listFiles(); if (files == null) return false; for (File file : files) { file.deleteOnExit(); } return true; } }