/** 清除app缓存 */ public void clearAppCache() { // 清除webview缓存 File file = CacheManager.getCacheFileBaseDir(); if (file != null && file.exists() && file.isDirectory()) { for (File item : file.listFiles()) { item.delete(); } file.delete(); } deleteDatabase("webview.db"); deleteDatabase("webview.db-shm"); deleteDatabase("webview.db-wal"); deleteDatabase("webviewCache.db"); deleteDatabase("webviewCache.db-shm"); deleteDatabase("webviewCache.db-wal"); // 清除数据缓存 clearCacheFolder(getFilesDir(), System.currentTimeMillis()); clearCacheFolder(getCacheDir(), System.currentTimeMillis()); // 2.2版本才有将应用缓存转移到sd卡的功能 if (isMethodsCompat(android.os.Build.VERSION_CODES.FROYO)) { clearCacheFolder(MethodsCompat.getExternalCacheDir(this), System.currentTimeMillis()); } // 清除编辑器保存的临时内容 Properties props = getProperties(); for (Object key : props.keySet()) { String _key = key.toString(); if (_key.startsWith("temp")) removeProperty(_key); } }
/** 清除appç¼“å˜ */ public void clearAppCache() { // 清除webviewç¼“å˜ File file = CacheManager.getCacheFileBaseDir(); if (file != null && file.exists() && file.isDirectory()) { for (File item : file.listFiles()) { item.delete(); } file.delete(); } deleteDatabase("webview.db"); deleteDatabase("webview.db-shm"); deleteDatabase("webview.db-wal"); deleteDatabase("webviewCache.db"); deleteDatabase("webviewCache.db-shm"); deleteDatabase("webviewCache.db-wal"); // 清除数æ�®ç¼“å˜ clearCacheFolder(getFilesDir(), System.currentTimeMillis()); clearCacheFolder(getCacheDir(), System.currentTimeMillis()); // 2.2版本æ‰�有将应用缓å˜è½¬ç§»åˆ°sdå�¡çš„功能 // if(isMethodsCompat(android.os.Build.VERSION_CODES.FROYO)){ // clearCacheFolder(MethodsCompat.getExternalCacheDir(this),System.currentTimeMillis()); // } // 清除编辑器ä¿�å˜çš„临时内容 Properties props = getProperties(); for (Object key : props.keySet()) { String _key = key.toString(); if (_key.startsWith("temp")) removeProperty(_key); } }