コード例 #1
0
  private void updateProfile() {
    // Updates profile object with user's settings
    profile.setName(name.getText().toString().trim());
    profile.setMinutes(Integer.parseInt(textTimeMinutes.getText().toString()));
    profile.setSeconds(Integer.parseInt(textTimeSeconds.getText().toString()));
    profile.setRepeat(repeat.isChecked());

    // Only set user's repeatNumber if repeat is checked
    profile.setRepeatNumber(
        (repeat.isChecked()) ? Integer.parseInt(repeatNumber.getText().toString()) : 0);

    dbHandler.saveEditedProfile(profile);
  }
コード例 #2
0
  private void addProfile() {
    // Creates a profile object with user's settings (to be inserted to the database)
    Profile newProfile = new Profile(name.getText().toString().trim());
    newProfile.setMinutes(Integer.parseInt(textTimeMinutes.getText().toString()));
    newProfile.setSeconds(Integer.parseInt(textTimeSeconds.getText().toString()));
    newProfile.setRepeat(repeat.isChecked());

    // Only set user's repeatNumber if repeat is checked
    newProfile.setRepeatNumber(
        (repeat.isChecked()) ? Integer.parseInt(repeatNumber.getText().toString()) : 0);

    dbHandler.addProfile(newProfile);
  }