Android Open Source - big_nerd_ranch_book_progress Crime Fragment

From Project

Back to project page big_nerd_ranch_book_progress.


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

import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
/*from  w  ww . j  av a  2  s  .co  m*/

public class CrimeFragment extends Fragment {
  private Crime mCrime;
  private EditText mTitleField;
  private Button mDateButton;
  private CheckBox mSolvedCheckBox;
  public void onCreate(Bundle savedInstanceState) {
    mCrime = new Crime();

  public View onCreateView(LayoutInflater inflater, ViewGroup parent,
      Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_crime, parent, false);
    mTitleField  = (EditText)v.findViewById(;
    mTitleField.addTextChangedListener(new TextWatcher() {
      public void onTextChanged(CharSequence c, int start, int before, int count) {

      public void afterTextChanged(Editable c) {
        // TODO Auto-generated method stub

      public void beforeTextChanged(CharSequence c, int start, int count,
          int after) {
        // TODO Auto-generated method stub
    mDateButton = (Button)v.findViewById(;
    mSolvedCheckBox = (CheckBox)v.findViewById(;
    mSolvedCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
      public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        // Set the crime's solved property
    return v;

Java Source Code List