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:
- after removing item by clicking button, progressbar appear.
- progressbar is still appear of removed position
progressbar at 0 at new position and its appear
Now exactly what I want:
- after removing item by clicking button, progressbar will also gone with recycler item and it will not affect at other position
Source: Android Questions