【问题标题】:android ProgressBar updateing during download下载期间的android ProgressBar更新
【发布时间】:2014-10-29 06:42:14
【问题描述】:

在我的文件下载应用程序中,有一个 ListView,每一行都包含属性文件和一个 ProgressBar,用于下载它的状态,我使用 View Holder 模式,但进度条不更新

@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();
        }
    }

【问题讨论】:

  • 我认为 'bar1' 始终为空..
  • @fatboy 我检查了它,它不为空

标签: android listview progress-bar


【解决方案1】:

尝试拨打notifyDataSetChanged

        protected void onPostExecute(Boolean result) {
            ...
            myListView.notifyDataSetChanged(); //or simply notifyDataSetChanged if your Async inside adapter
        }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-14
    • 1970-01-01
    • 2017-08-15
    • 1970-01-01
    相关资源
    最近更新 更多