Display Paging Data in a RecyclerView List

We have three tasks to complete in PlayersFragment: bind the playersList RecyclerView, implement a searchPlayers function, and bind the playerSearchBoxText text box. We’re starting off with the RecyclerView since we’ve done it before, and if you copied PlayersFragment from the Code directory, you can skip this part:

 override​ ​fun​ ​onCreateView​(
  inflater: LayoutInflater,
  container: ViewGroup?,
  savedInstanceState: Bundle?
 ): View {
»val​ binding = FragmentPlayersBinding.inflate(inflater)
 
»this​.playersAdapter = PlayersAdapter()
 
» with(binding.playersList) {
» adapter = playersAdapter
» addItemDecoration(
» DividerItemDecoration(context, LinearLayoutManager.VERTICAL)
» )
» }
 
 // Bind the ...

Get Kotlin and Android Development featuring Jetpack 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.