我必须Activity在其中更新 的进度ProgressBar,并使用从不同类获得的值。
在下载类中,我使用此函数来计算进度..
public void publishDownloadProgress(long lengthoffile, long bytesDownloaded){
mFileLength = lengthoffile;
totalBytesDownloaded = bytesDownloaded;
mProgress = ((totalBytesDownloaded*100)/mFileLength);
}
这是为了取得进展
public long getDownloadProgress(){
return mProgress;
}
但是当我使用getDownloadProgress(); 在我的Activity,我只得到0这是可以理解的,因为它只得到一次。
但是我喜欢的是一系列连续的进度值,我想使用这些值来更新我的ProgressBar,怎么做?