Android 在Recyclerview中更新progressbar

Android 在Recyclerview中更新progressbar,android,android-recyclerview,Android,Android Recyclerview,我想更新recyclerview项目中的进度条。 现在我不知道如何在一个项目中获取progressbar并从另一个类中更新它,而这个类无论如何都不会与这个适配器连接 这是我的密码: public class TransmissionAdapter extends RecyclerView.Adapter<TransmissionAdapter.ViewHolderUI> { public static class ViewHolderUI extends RecyclerV

我想更新recyclerview项目中的进度条。 现在我不知道如何在一个项目中获取progressbar并从另一个类中更新它,而这个类无论如何都不会与这个适配器连接

这是我的密码:

public class TransmissionAdapter extends RecyclerView.Adapter<TransmissionAdapter.ViewHolderUI> {

    public static class ViewHolderUI extends RecyclerView.ViewHolder{

        ImageView fileTypeImage;
        TextView fileName;
        TextView progressDescription;
        TextView timeAgoTrans;
        ProgressBar uploadProgess;

        public ViewHolderUI(View itemView) {
            super(itemView);

            fileTypeImage = (ImageView) itemView.findViewById(R.id.file_type_image);
            fileName = (TextView) itemView.findViewById(R.id.file_name);
            progressDescription = (TextView) itemView.findViewById(R.id.progress_description);
            timeAgoTrans = (TextView) itemView.findViewById(R.id.time_ago_trans);
            uploadProgess = (ProgressBar) itemView.findViewById(R.id.progress_bar_transmission);
        }

    }


    @Override
    public ViewHolderUI onCreateViewHolder(ViewGroup viewGroup, int viewType) {
        View itemView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.card_view, null);

        return new ViewHolderUI(itemView);
    }

    @Override
    public void onBindViewHolder(ViewHolderUI holder, int position) {

        holder.fileName.setText(TransmissionsView.itemTexte.get(position));
    }

    @Override
    public int getItemCount() {
        return TransmissionsView.itemTexte.size();
    }


}
公共类TransmissionAdapter扩展了RecyclerView.Adapter{
公共静态类ViewHolderUI扩展了RecyclerView.ViewHolder{
ImageView文件类型图像;
文本视图文件名;
文本视图描述;
TextView TimeAgontrans;
进度条上传进度;
公共视图持有者UI(视图项视图){
超级(项目视图);
fileTypeImage=(ImageView)itemView.findViewById(R.id.file\u type\u image);
fileName=(TextView)itemView.findViewById(R.id.file\u name);
progressDescription=(TextView)itemView.findViewById(R.id.progress\u description);
timeagontrans=(TextView)itemView.findViewById(R.id.time\u ago\u trans);
UploadProgress=(ProgressBar)itemView.findViewById(R.id.progress\u bar\u传输);
}
}
@凌驾
公共ViewHolderUI onCreateViewHolder(视图组视图组,int-viewType){
View itemView=LayoutFlater.from(viewGroup.getContext()).inflate(R.layout.card_视图,null);
返回新的ViewHolderUI(itemView);
}
@凌驾
BindViewHolder上的公共无效(ViewHolderUI holder,内部位置){
holder.fileName.setText(TransmissionsView.itemTexte.get(position));
}
@凌驾
public int getItemCount(){
返回TransmissionsView.itemTexte.size();
}
}

我尝试将进度放入arraylist,并使用notifyDataSetChanged更新recyclerlist中的进度,并在“onBindViewHolder”方法中设置当前进度。但是如果progressbar是为了加快UI线程跳过的帧,那么这是正确的方法吗

当你想更新进度条的时候?如果你使用共享菜单运行应用程序,我会运行一个新类,其中会上载一些文件,所以我想显示进度