From the course: Building an Android App with Jetpack Libraries

Unlock the full course today

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

Bind data to the RecyclerView

Bind data to the RecyclerView - Android Tutorial

From the course: Building an Android App with Jetpack Libraries

Start my 1-month free trial

Bind data to the RecyclerView

- I previously created an adaptor class to manage the display of my data in the recycler view, I added an inner class, the view holder, and that contains references to all of the views inside the XML layout file, now I need to add three more functions. I'll generate the stubs for those functions by placing the cursor in the class name and then using an intention action and choosing implement members. I'll select all three suggested functions and generate the stubs. First I'll deal with get item count. This function is called by the recycler view to find out how many data items there are in the list. Now, simply pass back notes list.size. The on create view holder function is called each time a new list item is generated. It's job is to get those references to views and then return the view holder object. This is where you decide which XML layout file you're going to use. I'll create an inflator variable and I'll get…

Contents