From the course: Building an Android App with Jetpack Libraries

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Create a RecyclerView adapter

Create a RecyclerView adapter - Android Tutorial

From the course: Building an Android App with Jetpack Libraries

Start my 1-month free trial

Create a RecyclerView adapter

- [Instructor] The recyclerview component uses an adaptor class to manage its data at runtime, the adapter breaks down its tasks into a number of different functions. I'll create a new Kotlin class in my base package and I'll name it NotesListAdapter. When I initialize this class, I'll pass in the reference to the data and I'll do that with a new property, that will be private to the class. It'll be immutable, it'll be called notesList and its data type will be a list of note entity objects. Now this class has to extend itself from a class named recyclerview.adapter. I'll declare that right here and I'll set it's generic type like this. I'm going to be creating an inner class of NotesListAdaptor named view holder. So I'll reference it right here. I'll add parentheses here, because this is a constructor call. Then I'll use an intention action and create the class and I'll include it in this file. I'll mark…

Contents