Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class ItemsAdapter(
private val context: Context,
private var items: List<Item>
) :
RecyclerView.Adapter<ItemsAdapter.ItemViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
return ItemViewHolder(
LayoutInflater.from(context).inflate(R.layout.item_item, parent, false)
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
override fun getItemCount(): Int {
return items.size
class ItemViewHolder(private val view: View) :
RecyclerView.ViewHolder(view) {
fun bind(item: Item) {
view.findViewById<TextView>( = item.content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment