Handle Paging Data in the App
Now we’re getting into the core of this chapter and all the cool, new features. This is also the part that may need to change depending on if anything changes with the Paging library in the future, so heads up in case anything isn’t working as you’d expect. Let’s start off with something more comfortable and add in our BaseballDao functions.
Manage PlayerListItem Objects in the Database
We need three new functions related to PlayerListItem objects: getPlayerListItems, insertPlayerListItems, and deleteAllPlayerListItems. None of these new functions contain anything new except that we’re returning a PagingSource object from our @Query function:
| @Query( |
| """ |
| SELECT * FROM player_list_items |
| WHERE (:teamId ... |
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.