I
I
Ilya Kolpakov2020-08-27 11:40:46
Android
Ilya Kolpakov, 2020-08-27 11:40:46

How to create an adapter for RecycleView?

Why is the ViewHolder highlighted in red (on lines with //###) and it says Unresolved reference? What have I done wrong? In all videos and code examples, it's exactly the same.

class RecyclerAdapter : RecyclerView.Adapter<RecyclerAdapter.ViewHolder>(){                           //###
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerAdapter.ViewHolder {             //###
        TODO("Not yet implemented")
    }

    override fun getItemCount(): Int {
        TODO("Not yet implemented")
    }

    override fun onBindViewHolder(holder: RecyclerAdapter.ViewHolder, position: Int) { //###
        TODO("Not yet implemented")
    }

}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya Kolpakov, 2020-08-27
@kivinus1

Recently solved the problem. My project was named RecycleView because I usually name a project the topic I'm learning about. Because of this, there was confusion in the project
(a very stupid mistake, the second time on the same rake)

I
illuzor, 2020-08-27
@iLLuzor

It looks like there are no imports or the recyclerview library is not connected

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question