Android Open Source - big_nerd_ranch_book_progress Crime Lab






From Project

Back to project page big_nerd_ranch_book_progress.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project big_nerd_ranch_book_progress listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.bignerdranch.android.criminalintent;
// w w  w .ja va  2s . c o  m
import java.util.ArrayList;
import java.util.UUID;

import android.content.Context;

public class CrimeLab {
  private ArrayList<Crime> mCrimes;
  private static CrimeLab sCrimeLab;
  private Context mAppContext;
  
  private CrimeLab(Context appContext) {
    mAppContext = appContext;
    mCrimes = new ArrayList<Crime>();
    for (int i = 0; i < 100; i++) {
      Crime c = new Crime();
      c.setmTitle("Crime #" + i);
      c.setSolved(i % 2 == 0); // Every other one
      mCrimes.add(c);
    }
  }
  
  public static CrimeLab get(Context c) {
    if (sCrimeLab == null) {
      sCrimeLab = new CrimeLab(c.getApplicationContext());
    }
    return sCrimeLab;
  }
  
  public ArrayList<Crime> getCrimes() {
    return mCrimes;
  }
  
  public Crime getCrime(UUID id) {
    for (Crime c : mCrimes) {
      if (c.getmId().equals(id))
        return c;
    }
    return null;
  }
}




Java Source Code List

com.bignerdranch.android.criminalintent.CrimeActivity.java
com.bignerdranch.android.criminalintent.CrimeFragment.java
com.bignerdranch.android.criminalintent.CrimeLab.java
com.bignerdranch.android.criminalintent.CrimeListActivity.java
com.bignerdranch.android.criminalintent.CrimeListFragment.java
com.bignerdranch.android.criminalintent.Crime.java
com.bignerdranch.android.criminalintent.SingleFragmentActivity.java
com.bignerdranch.android.geoquiz.BuildConfig.java
com.bignerdranch.android.geoquiz.CheatActivity.java
com.bignerdranch.android.geoquiz.QuizActivity.java
com.bignerdranch.android.geoquiz.QuizActivity.java
com.bignerdranch.android.geoquiz.TrueFalse.java
com.bignerdranch.android.geoquiz.TrueFalse.java