this is my xml file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="80dp"
android:paddingStart="8dp"
android:paddingEnd="8dp">
<TextView
android:id="@+id/tvTodoTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/like_this"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/cbDone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/cbDone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
this is my kotlin class
package com.example.todo.example.todolist
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.todo.R
import res.xml
class TodoAdapter (
private val todos: MutableList<Todo>
) :RecyclerView.Adapter<TodoAdapter.TodoViewHolder>(){
class TodoViewHolder(itemView: View) :RecyclerView.ViewHolder(itemView)
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TodoViewHolder {
return TodoViewHolder(
LayoutInflater.from(parent.context).inflate(
R.layout.item_todo,
parent,
false
)
)
}
override fun onBindViewHolder(holder: TodoViewHolder, position: Int) {
val curTodo= todos[position]
holder.itemView.apply {
tVTodoTitle.text= curTodo.title
cbDone.isChecked=curTodo.isChecked
}
}
override fun getItemCount(): Int {
return todos.size
}
}
when trying to write tvTitleTodo or cbDone in kotlin class it gives an error and is unable to see the tvTitleTodo and cbDone in the xml file,and I can't tell what is wrong with my code or should i try importing the xml file?I'm talking about the onBindViewHolder part. please someone help