Updating the Model Layer

Figure 20.6 shows the relationship between CrimeFragment, Crime, and Photo.

Figure 20.6  Model objects and CrimeFragment

Model objects and CrimeFragment

Adding a Photo class

Create a new class in the com.bignerdranch.android.criminalintent package. Name it Photo and leave its superclass as java.lang.Object.

In Photo.java, add the fields and methods shown in Listing 20.8.

Listing 20.8  The Photo class (Photo.java)

.​.​.​

p​u​b​l​i​c​ ​c​l​a​s​s​ ​P​h​o​t​o​ ​{​
 ​ ​ ​ ​p​r​i​v​a​t​e​ ​s​t​a​t​i​c​ ​f​i​n​a​l​ ​S​t​r​i​n​g​ ​J​S​O​N​_​F​I​L​E​N​A​M​E​ ​=​ ​"​f​i​l​e​n​a​m​e​"​;​

 ​ ​ ​ ​p​r​i​v​a​t​e​ ​S​t​r​i​n​g​ ​m​F​i​l​e​n​a​m​e​;​

 ​ ​ ​ ​/​*​*​ ​C​r​e​a​t​e​ ...

Get Android Programming: The Big Nerd Ranch Guide 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.