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 - Android Tutorial
From the course: Building an Android App with Jetpack Libraries
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
-
-
-
-
Add a navigation controller to the activity5m 39s
-
(Locked)
Add a RecyclerView to the main fragment5m 30s
-
(Locked)
Create a custom layout for list rows3m 56s
-
(Locked)
Create a data entity class3m 57s
-
(Locked)
Create sample data for testing5m 27s
-
(Locked)
Create a RecyclerView adapter2m 42s
-
(Locked)
Bind data to the RecyclerView4m 58s
-
-
-
-
-
-