Unresolved reference: textView

I’m trying to create a recyclerView, but when I try to reference my textView I get an error that says Unresolved Reference: textViewTitle, I have tried many ways and I could not, I appreciate your wise help.

class RecyclerAdapter(private val userList: ArrayList<Sitios> = ArrayList()) :
    RecyclerView.Adapter<RecyclerAdapter.ViewHolder>() {

    inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val v = LayoutInflater.from(parent.context).inflate(R.layout.card_view, parent, false)

        return ViewHolder(v)

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {

        //Unresolved reference: textViewTitle
        holder.itemView.textViewTitle.text = userList[position].description

    override fun getItemCount(): Int = userList.size

replace with holder.itemView.findViewById<TextView>(R.id.textViewTitle).text = ...
or use something like Data Binding or View Binding

1 Like