在我的文件下载应用程序中,有一个 ListView,每一行都包含属性文件和一个用于下载其状态的进度栏,我使用视图持有者模式,但进度栏不更新
@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
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)