/** Answer to search button, go to next activity to do a search */
  public void searchPatient() {
    Intent intent = new Intent(this, FoundPatientsActivity.class);

    // Passing data to next activity
    EditText editFirstName = (EditText) findViewById(R.id.edit_first_name);
    if (editFirstName.getText().length() == 0) {
      intent.putExtra(EXTRA_FIRST_NAME, "");
    } else {
      String first_name = editFirstName.getText().toString();
      intent.putExtra(EXTRA_FIRST_NAME, first_name);
    }

    EditText editLastName = (EditText) findViewById(R.id.edit_last_name);
    if (editLastName.getText().length() == 0) {
      Toast.makeText(this, R.string.invalidFamilyName, Toast.LENGTH_LONG).show();
      return;
    } else {
      String last_name = editLastName.getText().toString();
      intent.putExtra(EXTRA_LAST_NAME, last_name);
    }

    // Check value of Gender Radio Group
    RadioButton maleButton = (RadioButton) findViewById(R.id.radio0);
    RadioButton femaleButton = (RadioButton) findViewById(R.id.radio1);

    if (maleButton.isChecked()) {
      intent.putExtra(EXTRA_GENDER, "t");
    } else if (femaleButton.isChecked()) {
      intent.putExtra(EXTRA_GENDER, "f");
    } else {
      intent.putExtra(EXTRA_GENDER, "");
    }

    if (SEND_DATE) {
      // Getting date of birth
      DatePicker birth = (DatePicker) findViewById(R.id.datePicker);
      String born_on =
          DateUtils.dateString(birth.getDayOfMonth(), birth.getMonth(), birth.getYear());

      intent.putExtra(EXTRA_BORN_ON, born_on);
    } else {
      intent.putExtra(EXTRA_BORN_ON, "");
    }

    intent.putExtra(EXTRA_VILLAGE_ID, village_id);

    // Avoid the Activity finish when back key is pressed in next Activity
    intent.putExtra(EXTRA_FINISH_ACTIVITY, false);

    // Starting new activity and hoping a result for finish by itself
    startActivityForResult(intent, 0);
  }
  /** Answer to create button, go to next activity to create a new patient */
  public void createPatient() {
    Intent intent = new Intent(this, ShowNewPatientActivity.class);

    // Passing data to next activity
    EditText editFirstName = (EditText) findViewById(R.id.edit_first_name);
    if (editFirstName.getText().length() == 0) {
      Toast.makeText(this, R.string.invalidFirstName, Toast.LENGTH_LONG).show();
      return;
    } else {
      String first_name = editFirstName.getText().toString();
      intent.putExtra(EXTRA_FIRST_NAME, first_name);
    }

    EditText editLastName = (EditText) findViewById(R.id.edit_last_name);
    if (editLastName.getText().length() == 0) {
      Toast.makeText(this, R.string.invalidFamilyName, Toast.LENGTH_LONG).show();
      return;
    } else {
      String last_name = editLastName.getText().toString();
      intent.putExtra(EXTRA_LAST_NAME, last_name);
    }

    // Check value of Gender Radio Group
    RadioButton maleButton = (RadioButton) findViewById(R.id.radio0);
    RadioButton femaleButton = (RadioButton) findViewById(R.id.radio1);

    if (maleButton.isChecked()) {
      intent.putExtra(EXTRA_GENDER, "t");
    } else if (femaleButton.isChecked()) {
      intent.putExtra(EXTRA_GENDER, "f");
    } else {
      Toast.makeText(this, R.string.pressGender, Toast.LENGTH_LONG).show();
      return;
    }

    // Getting date of birth
    DatePicker birth = (DatePicker) findViewById(R.id.datePicker);
    int day = birth.getDayOfMonth();
    int month = birth.getMonth();
    int year = birth.getYear();

    if (DateUtils.differenceWithCurrentDate(year, month, day) < 0) {
      Toast.makeText(this, R.string.invalidDate, Toast.LENGTH_LONG).show();
      return;
    } else {
      String born_on =
          DateUtils.dateString(birth.getDayOfMonth(), birth.getMonth(), birth.getYear());
      intent.putExtra(EXTRA_BORN_ON, born_on);
    }

    if (village_id == -1 || zone_id == -1) {
      Toast.makeText(this, R.string.invalidVillage, Toast.LENGTH_LONG).show();
      return;
    } else {
      intent.putExtra(EXTRA_VILLAGE_ID, village_id);
      intent.putExtra(EXTRA_ZONE_ID, zone_id);
    }
    intent.putExtra(EXTRA_FINISH_ACTIVITY, false);

    // Starting new activity and hoping a result for finish by itself
    startActivityForResult(intent, 0);
  }