Skip to content

Instantly share code, notes, and snippets.

@biodunalfet
Created June 7, 2016 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biodunalfet/dde5cf3f2b1cffe79c6926404504daa7 to your computer and use it in GitHub Desktop.
Save biodunalfet/dde5cf3f2b1cffe79c6926404504daa7 to your computer and use it in GitHub Desktop.
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (holder.getItemViewType() == CHILD){
TextView viewID = ((ChildViewHolder)holder).viewID;
TextView parentID = ((ChildViewHolder)holder).parentID;
TextView text = ((ChildViewHolder)holder).text;
Friend friend = (Friend) general.get(position);
viewID.setText(friend.getId());
parentID.setText(friend.getParentID());
text.setText(friend.getName());
}
else {
TextView viewID = ((ParentViewHolder)holder).viewID;
TextView personNameID = ((ParentViewHolder)holder).personNameID;
Person person = (Person) general.get(position);
viewID.setText(person.getId());
personNameID.setText(person.getName());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment