How can I call bindViewHolder
on my recyclerView's adapter when my list of data changes?
I have 2 recyclerViews, selecting an item in one of them adds to the list of the second. Can I use a listener to check for change of data in my list or do I need to call bindViewHolder
on my onClick
function?
Here's how my onClickListener
is implemented. selectedContacts
is the list used in the second recyclerView.
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(rowLayout, viewGroup, false);
return new ViewHolder(view, new ViewHolder.ViewHolderClickable() {
@Override
public void onClick(View contactView, int position) {
selectedContacts.add(contacts.get(position));
}
});
}