Android WebView 清理缓存

private void clearCache(){
        File file = getCacheDir().getAbsoluteFile();//删除缓存
        deleteFile(file);
    }

    public void deleteFile(File file) {

        if (file.exists()) {
            if (file.isFile()) {
                file.delete();
            } else if (file.isDirectory()) {
                File files[] = file.listFiles();
                for (int i = 0; i < files.length; i++) {
                    deleteFile(files[i]);
                }
            }
            file.delete();
        } 
    }

你可能感兴趣的:(Android WebView 清理缓存)