@Override public File doInBackgroundWithException(Object... params) throws Exception { Log.t("... start extracting file", zipFile); ZipFile zf = new ZipFile(zipFile); Enumeration<? extends ZipEntry> e = zf.entries(); long totalUncompressedSize = 0; while (e.hasMoreElements()) { ZipEntry ze = e.nextElement(); totalUncompressedSize += ze.getSize(); } zf.close(); if (totalUncompressedSize > 0) setTotalUncompressedSize(totalUncompressedSize); Log.t("... size uncompressed: " + totalUncompressedSize); return super.doInBackgroundWithException(params); }
@Override protected void onPostSuccess(File destinationFile) { super.onPostSuccess(destinationFile); Log.t("... finished unzipping file"); StringBuilder log = new StringBuilder("... should delete source:" + deleteSourceOnSuccess); if (deleteSourceOnSuccess) { if (zipFile != null) { if (zipFile.exists()) { if (zipFile.delete()) { log.append(" - success"); } } else { log.append(" - ").append(zipFile).append(" does not exist"); } } else { log.append(" - zipfile null"); } } Log.t(log); }