InputStream input = connection.getInputStream(); FileOutputStream output = new FileOutputStream(archivos.PathArchivosApp + "app.zip"); byte data[] = new byte[4096]; long total = 0; int count; while ((count = input.read(data)) != -1) { // allow canceling with back button if (isCancelled()) return false; total += count; // publishing the progress.... if (fileLength > 0) // only if total length is known onProgressUpdate((int) (total * 100 / fileLength)); output.write(data, 0, count); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)