I'm using a recyclerview to display a list of interests one could choose from. Clicking the very first item makes the very last item also selected
Selecting first item:
Last item is also selected:
The selection is done with this code:
@Override
public InterestViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
TextView v = (TextView) LayoutInflater.from(parent.getContext())
.inflate(R.layout.interests_textview, parent, false);
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView textView = (TextView) v;
if (textView.getCompoundDrawables()[2] == null) {
textView.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.checkmark, 0);
} else {
textView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
}
}
});
return new InterestViewHolder(v);
}
Also the very first item is also selected, when clicking the very last item. Who knows what could cause this?