'I can't add id from XML

enter image description here

Why can't I add this id here?



Solution 1:[1]

If you want to access the TextView directly from the itemView you should use findViewById:

holder.itemView.findViewById<TextView>(R.id.tvTodoTitle).apply {
    // Initialize the TextView here...
    text = "Example"
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1