How to keep same position of recyclerview’s progressbar?

Here I have a viewHolderclass of recyclerview, in which I implement OnClickListener button like below code.

public class RemoveHolder extends RecyclerView.ViewHolder implements View.OnClickListener
{
 Button removeButton;
 private RemoveHolder (@NonNull View itemView) {
            super(itemView);
            removeButton =itemView.findViewById(R.id.remove_button);
            removeProgress =itemView.findViewById(R.id.remove_progress);
            removeButton.setOnClickListener(this);
        }
@Override
        public void onClick(View v) {
            if (v.getId() == R.id.remove_button)
            {
                    buttonToProgressAnim();
                    List.remove(getAdapterPosition());
                    notifyDataSetChanged();
            }
        }
}

exactly what I get:

  1. after removing item by clicking button, progressbar appear.
  2. progressbar is still appear of removed position

clicked position 0

progressbar at 0 at new position and its appear

same thing happening

Now exactly what I want:

  1. after removing item by clicking button, progressbar will also gone with recycler item and it will not affect at other position

Source: Android Questions

LEAVE A COMMENT