Я загружаю видео с URL, когда я пытаюсь получить прогресс, он показывает минус значение, ниже я добавил свой код,
byte[] buffer = new byte[1024];
int len1 = 0;
long total = 0;
while ((len1 = is.read(buffer)) != -1) {
if (cancelDialogStatus) {
break;
}
Log.e("System out", "doInBackground: progress:::" + len1);
total += len1;
// publishing the progress....
// After this onProgressUpdate will be called
int prg = (int) ((total * 100) / lenghtOfFile);
Log.d("System out", "doInBackground: progress:::" + prg);
if (prg > 100) {
publishProgress(""
+ 100);
fos.write(buffer, 0, len1);
break;
} else {
publishProgress(""
+ (int) ((total * 100) / lenghtOfFile));
fos.write(buffer, 0, len1);
}
}