I'm working on a app that downloads files, I have recyclerview -> cardview (10-20 items), if you click on one the items the process to download the file begins, and at the same time i add a spinner to let user know that the download is in process but I'm having problem canceling the spinner once the download is complete, because I don't know how to reference back an specific cardview on the recyclerview, do i need to pass the position of the card view, the spinner(progressbar) id ?
any help will be appreciated, thank you!
from my adapter class
@Override
public void onBindViewHolder(@NonNull final FirstLevelViewHolder holder, final int position) {
ItemsLevel2 currentItem = fItems.get(position);
final String id = currentItem.getId();
final String name = currentItem.getName();
holder.id.setText(id);
holder.ame.setText(name);
holder.fImageButton .setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
holder.img.setVisibility(View.INVISIBLE);
holder.spinner.setVisibility(View.VISIBLE);
downloadFile(name);
}
});
}
Here I have all the code for the download
downloadFile(String name) {
}