‫After we created the Recycler View Adapter class.
‫Now let's move to the main activity and continue with the display user's list function.
‫Here I'm going to call my Recycler View Adapter class.
‫And here I'm going to pass it the first parameter.
‫And the second parameter is a lambda expression.
‫So here you can see we need to pass a context list.
‫Which is it.
‫I'm referring it.
‫And you can see it it inside the scope is a list of contacts.
‫And the second parameter is a lambda expression.
‫I want from you to focus with me.
‫Here I'm going to create a lambda expression selected item.
‫It's of type contact.
‫And the lambda expression will give us and execute a list item.
‫Click function and pass for this function the selected item.
‫What does this code mean?
‫It refers to the implicit single parameter of the lambda expression.
‫It's often used when working with collections or sequences representing each item of the collection
‫in the lambda, and this it is a list in this case, because the observer scope.
‫It refers for a list of contacts, and here the second parameter is a lambda expression.
‫This lambda expression takes a single parameter named as selected item.
‫It's of type contact and calls the list item clicked function with that parameter the selected item.
‫This declares a parameter named selected item of type contact within the lambda expression, and this
‫arrow separates the parameter list.
‫This is the parameter list from the body of the lambda expression.
‫Now I'm going to call this function and create it.
‫So I'm going to create it outside the display users list function private function list item clicked
‫pass a parameter of type contact in order to detect the selected contact.
‫Then I'm going to display a toast message telling the user the selected item.
‫So the first parameter is this.
‫The second parameter message selected name is.
‫And here I'm getting the selected item dot name.
‫And the third parameter is the toast length which is long dot show method.
‫Call the contact ViewModel dot initiate, update and delete for the selected item.
‫By this I am passing a Lambda expression and calling the list item clicked function here.
‫This is good.
‫Save the project, run our application and we have an error here telling us that the I o must be annotated
‫with at the I o annotation.
‫So let's go to the contact dao and oops, I missed the at Dao annotation annotated with add dao and
‫let's run again.