/** * 获取webViewCache的下所有的文件长度 * @return */ public static long getWebCacheLegth(){ long length = 0; String path = Environment.getDataDirectory() +"/data/" + Config.PACKAGE + "/cache/" +"/webviewCache/"; File file = new File(path); File[] tempList = file.listFiles(); if(tempList!=null){ for(int i =0 ; i < tempList.length ; i++){ if(tempList[i].isFile()){ //文件 File tempFile = tempList[i]; length += tempFile.length(); Log.i("getWebCacheLegth22222", String.valueOf(tempFile.getName())); } if(tempList[i].isDirectory()){ //文件夹 } } } path = Environment.getDataDirectory() + "/data/" + Config.PACKAGE + "/databases/webview.db"; file = new File(path); length += file.length(); path = Environment.getDataDirectory() + "/data/" + Config.PACKAGE + "/databases/webviewCache.db"; file = new File(path); length += file.length(); return length; }