Android Programming The Big Nerd Ranch Guide, 3rd Edition
157 8. Displaying Lists with RecyclerView CriminalIntent’s model layer currently consists of a single instance of Crime. In this ...
Chapter 8 Displaying Lists with RecyclerView 158 Figure 8.2 shows the overall plan for CriminalIntent in this chapter. Figure 8 ...
Updating CriminalIntent’s Model Layer 159 Updating CriminalIntent’s Model Layer The first step is to upgrade CriminalIntent’s mo ...
Chapter 8 Displaying Lists with RecyclerView 160 Let’s give CrimeLab some Crime objects to store. In CrimeLab’s constructor, cr ...
An Abstract Activity for Hosting a Fragment 161 Eventually, the List will contain user-created Crimes that can be saved and relo ...
Chapter 8 Displaying Lists with RecyclerView 162 When you rename a resource, the references to it should be updated automatical ...
An abstract Activity class 163 Nearly every activity you will create in this book will require the same code. To avoid typing it ...
Chapter 8 Displaying Lists with RecyclerView 164 Using an abstract class Try it out with CrimeActivity. Change CrimeActivity’s ...
An abstract Activity class 165 The CrimeListFragment class has not yet been created. Let’s remedy that. Right-click on the com.b ...
Chapter 8 Displaying Lists with RecyclerView 166 CrimeListActivity is now the launcher activity. Run CriminalIntent and you wil ...
RecyclerView, Adapter, and ViewHolder 167 RecyclerView, Adapter, and ViewHolder Now, you want CrimeListFragment to display a lis ...
Chapter 8 Displaying Lists with RecyclerView 168 ViewHolders and Adapters The RecyclerView’s only responsibilities are recyclin ...
ViewHolders and Adapters 169 A RecyclerView never creates Views by themselves. It always creates ViewHolders, which bring their ...
Chapter 8 Displaying Lists with RecyclerView 170 When the RecyclerView needs a view object to display, it will have a conversat ...
Using a RecyclerView 171 Using a RecyclerView Enough talk; time for the implementation. The RecyclerView class lives in one of G ...
Chapter 8 Displaying Lists with RecyclerView 172 Now that CrimeListFragment’s view is set up, hook up the view to the fragment. ...
A view to display 173 A view to display Each item displayed on the RecyclerView will have its own view hierarchy, exactly the wa ...
Chapter 8 Displaying Lists with RecyclerView 174 CrimeHolder is all skin and bones right now. Later in the chapter, CrimeHolder ...
Implementing a ViewHolder and an Adapter 175 Now that you have an Adapter, connect it to your RecyclerView. Implement a method c ...
Chapter 8 Displaying Lists with RecyclerView 176 Run CriminalIntent and scroll through your new RecyclerView, which should look ...
«
5
6
7
8
9
10
11
12
13
14
»
Free download pdf