Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/179.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android ProgressBar在下载期间更新_Android_Listview_Progress Bar - Fatal编程技术网

android ProgressBar在下载期间更新

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

在我的文件下载应用程序中,有一个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
        }

我想“bar1”总是空的。@fatboy我查过了,它不是空的