recylerview kotlin adapter code example

Example: recylerview kotlin

class CustomAdapter(private val dataSet: Array<String>) :
        RecyclerView.Adapter<CustomAdapter.ViewHolder>() {

    class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
       
    }

    
    override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): ViewHolder {
      
    }

    // Replace the contents of a view (invoked by the layout manager)
    override fun onBindViewHolder(viewHolder: ViewHolder, position: Int) {
    
    }

  
    override fun getItemCount() = dataSet.size

}

Tags:

Misc Example