1
我使用,我想计算它的进展一个解压缩过程中的进步,这里是与计数器代码:这恰好包含747Java的计算上解压缩过程
float counter;
@Override
protected Boolean doInBackground(String... params) {
try {
String zipFile = Path + FileName;
String unzipLocation = Path;
FileInputStream fin = new FileInputStream(zipFile);
ZipInputStream zin = new ZipInputStream(fin);
ZipEntry ze = null;
while ((ze = zin.getNextEntry()) != null) {
counter++;
if (ze.isDirectory()) {
dirChecker(ze.getName());
} else {
FileOutputStream fout = new FileOutputStream(Path
+ ze.getName());
while ((length = zin.read(buffer)) > 0) {
fout.write(buffer, 0, length);
}
publishProgress((int)((counter/747.0)*100));
zin.closeEntry();
fout.close();
}
}
zin.close();
} catch (Exception e) {
mProgressDialog.dismiss();
return false;
}
return true;
}
@Override
protected void onProgressUpdate(Integer... values) {
mProgressDialog.setProgress(values[0]);
}
我只有1个.zip文件文件...为什么我使用数字747.
问题是值[0]始终为0 ..我是在计算过程的权利?我应该怎么做?谢谢。