Gutting CrimeLab

Now that you have a database, your next step is to change a lot of code inside of CrimeLab, swapping it to use mDatabase for storage instead of mCrimes.

Start out by doing some demolition. Strip out all the code related to mCrimes in CrimeLab.

Listing 14.7  Tearing down some walls (CrimeLab.java)

p​u​b​l​i​c​ ​c​l​a​s​s​ ​C​r​i​m​e​L​a​b​ ​{​
 ​ ​ ​ ​p​r​i​v​a​t​e​ ​s​t​a​t​i​c​ ​C​r​i​m​e​L​a​b​ ​s​C​r​i​m​e​L​a​b​;​

 ​ ​ ​ ​p​r​i​v​a​t​e​ ​L​i​s​t​<​C​r​i​m​e​>​ ​m​C​r​i​m​e​s​;​ ​ ​ ​ ​p​r​i​v​a​t​e​ ​C​o​n​t​e​x​t​ ​m​C​o​n​t​e​x​t​;​ ​ ​ ​ ​p​r​i​v​a​t​e​ ​S​Q​L​i​t​e​D​a​t​a​b​a​s​e​ ​m​D​a​t​a​b​a​s​e​;​ ​ ​ ​ ​p​u​b​l​i​c​ ​s​t​a​t​i​c​ ​C​r​i​m​e​L​a​b​ ​g​e​t​(​C​o​n​t​e​x​t​ ​c​o​n​t​e​x​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.