class DashboardRecyclerAdapter : RecyclerView.Adapter<DashboardRecyclerAdapter.DashboardViewHolder>()
Error in the :- <DashboardRecyclerAdapter.DashboardViewHolder>
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.surajpatil.navigationdrawer1.R
class DashboardRecyclerAdapter : RecyclerView.Adapter<DashboardRecyclerAdapter.DashboardViewHolder>(){
class DashboardViewHolder(view:View)
{
val textView: TextView = view.findViewById(R.id.txtRecyclerRowItem)
}
override fun onCreateViewHolder(parent: ViewGroup , viewType: Int): DashboardViewHolder {
TODO("Not yet implemented")
}
override fun onBindViewHolder(holder: DashboardViewHolder , position: Int) {
TODO("Not yet implemented")
}
override fun getItemCount(): Int {
TODO("Not yet implemented")
}
}
CodePudding user response:
Your problem is that DashboardViewHolder
does not inherit from RecyclerView.ViewHolder
. Have a look at the docs for some examples. It should look like this
class DashboardViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val textView: TextView = view.findViewById(R.id.txtRecyclerRowItem)
}