Skip to content

Instantly share code, notes, and snippets.

@PatilShreyas
Created July 21, 2019 12:03
Show Gist options
  • Save PatilShreyas/22471a849da16444cec38bd423bc0256 to your computer and use it in GitHub Desktop.
Save PatilShreyas/22471a849da16444cec38bd423bc0256 to your computer and use it in GitHub Desktop.
public class PostViewHolder extends RecyclerView.ViewHolder {
private TextView authorView;
private TextView messageView;
public PostViewHolder(@NonNull View itemView) {
super(itemView);
authorView = itemView.findViewById(R.id.post_AuthorName);
messageView = itemView.findViewById(R.id.post_Message);
}
public void bind(Post post) {
authorView.setText(post.authorName);
messageView.setText(post.message);
}
}
class PostViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
private var authorView: TextView = itemView.findViewById(R.id.post_AuthorName)
private var messageView: TextView = itemView.findViewById(R.id.post_Message)
fun bind(post: Post) {
authorView.text = post.authorName
messageView.text = post.message
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment