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); }
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); }