private void createCrimes() { for (int i = 1; i <= 100; ++i) { Crime c = new Crime(); c.setTitle("Crime #" + i); c.setSolved(i % 2 == 0); mCrimes.add(c); } }
private CrimeLab(Context appContext) { mAppContext = appContext; mCrimes = new ArrayList<Crime>(); for (int i = 0; i < 100; i++) { Crime c = new Crime(); c.setTitle("Crime #" + i); c.setSolved((i % 2) == 0); mCrimes.add(c); } }
// having a context allows the singleton to start activities access resources etc private CrimeLab(Context appContext) { mAppContext = appContext; mCrimes = new ArrayList<Crime>(); // creates 100 crimes for the arraylist model layer for (int i = 0; i < 100; i++) { Crime c = new Crime(); c.setTitle("Crime #" + i); c.setSolved(i % 2 == 0); // every other one mCrimes.add(c); } }