May 2022
Intermediate to advanced
688 pages
20h 12m
English
You want CrimeListFragment to display a list of crimes to the user. To do this, you will use a RecyclerView.
The RecyclerView class lives in another Jetpack library. So the first step to using a RecyclerView is to add the RecyclerView library as a dependency.
Listing 10.5 Adding RecyclerView dependency (app/build.gradle)
dependencies {
...
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
...
}
Again, sync your Gradle files before moving on.
Your RecyclerView will live in CrimeListFragment’s layout file. To create the layout file, right-click the res/layout directory in the project tool window and choose New → Layout resource ...
Read now
Unlock full access