I have an onClick
method that sets the current CardView
to a colour, but then all the previous CardViews
that had theironClick
method invoked also have their colour changed. What I am trying to do is to reset all the other CardViews
to their original colour and set the current CardView
to a different colour.
This is my code:
public ViewHolder(View view) {
super(view);
cardView = (CardView) view.findViewById(R.id.card_view);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cardView.setBackgroundColor(Color.RED);
}
});
}
So the above method sets the background colour for that cardview
which is great but I want the others to return back to their original colours. How would I go about doing that?
Thanks