android ProgressBar在下载期间更新
在我的文件下载应用程序中,有一个ListView,每行包含属性文件和一个用于下载状态的进度条,我使用视图持有者模式,但进度条不更新android ProgressBar在下载期间更新,android,listview,progress-bar,Android,Listview,Progress Bar,在我的文件下载应用程序中,有一个ListView,每行包含属性文件和一个用于下载状态的进度条,我使用视图持有者模式,但进度条不更新 @Override protected void onProgressUpdate(Long... values) { ProgressBar bar1; TextView status1; DownloadStructure.setProgress(values[0].intValue());
@Override
protected void onProgressUpdate(Long... values) {
ProgressBar bar1;
TextView status1;
DownloadStructure.setProgress(values[0].intValue());
bar1 = DownloadStructure.getProgressBarRefrence();
if (bar1 != null) {
bar1.setVisibility(View.VISIBLE);
bar1.setMax(values[2].intValue());
bar1.setProgress(DownloadStructure.getProgress());
bar1.Invalidate();
}
status1 = DownloadStructure.getProgressTextviewRefrence();
if (status1 != null) {
status1.setVisibility(View.VISIBLE);
status1.setText(DownloadStructure.getDownloadStatus());
status1.postInvalidate();
}
}
尝试调用notifyDataSetChanged:
protected void onPostExecute(Boolean result) {
...
myListView.notifyDataSetChanged(); //or simply notifyDataSetChanged if your Async inside adapter
}
我想“bar1”总是空的。@fatboy我查过了,它不是空的