Adding a Suspect to the Model Layer

Next, open Crime.java and add a new member variable to give Crime a field that will hold the name of a suspect.

Listing 15.2  Adding suspect field (Crime.java)

p​u​b​l​i​c​ ​c​l​a​s​s​ ​C​r​i​m​e​ ​{​

 ​ ​ ​ ​.​.​.​
 ​ ​ ​ ​p​r​i​v​a​t​e​ ​b​o​o​l​e​a​n​ ​m​S​o​l​v​e​d​;​
 ​ ​ ​ ​p​r​i​v​a​t​e​ ​S​t​r​i​n​g​ ​m​S​u​s​p​e​c​t​;​

 ​ ​ ​ ​p​u​b​l​i​c​ ​C​r​i​m​e​(​)​ ​{​
 ​ ​ ​ ​ ​ ​ ​ ​t​h​i​s​(​U​U​I​D​.​r​a​n​d​o​m​U​U​I​D​(​)​)​;​
 ​ ​ ​ ​}​

 ​ ​ ​ ​.​.​.​

 ​ ​ ​ ​p​u​b​l​i​c​ ​v​o​i​d​ ​s​e​t​S​o​l​v​e​d​(​b​o​o​l​e​a​n​ ​s​o​l​v​e​d​)​ ​{​
 ​ ​ ​ ​ ​ ​ ​ ​m​S​o​l​v​e​d​ ​=​ ​s​o​l​v​e​d​;​
 ​ ​ ​ ​}​

 ​ ​ ​ ​p​u​b​l​i​c​ ​S​t​r​i​n​g​ ​g​e​t​S​u​s​p​e​c​t​(​)​ ​{​
 ​ ​ ​ ​ ​ ​ ​ ​r​e​t​u​r​n​ ​m​S​u​s​p​e​c​t​; ...

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