Updating the RecyclerView

The RecyclerView uses an adapter to display each row of data. We’ll use a new AirportAdapter class for this purpose, to display the status of each airport.

Create a new Kotlin class file named AirportAdapter.kt that will hold the class AirportAdapter. Let’s start with this initial code for the class in this file:

 package​ ​com.agiledeveloper.airports
 
 import​ ​android.support.v7.widget.RecyclerView
 import​ ​android.view.LayoutInflater
 import​ ​android.view.View
 import​ ​android.view.ViewGroup
 import​ ​kotlinx.android.synthetic.main.airport_info.view.*
 
 class​ AirportAdapter : RecyclerView.Adapter<AirportViewHolder>() ...

Get Programming Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.