/** Put the ddbb saved data in the activity widgets */
  private void initActivity() {

    try {
      ClientDDBB clientDDBB = new ClientDDBB();

      // Togglebutton (QuuiteSleep service) check
      Settings settings = clientDDBB.getSelects().selectSettings();
      if (settings != null) {
        serviceToggleButton.setChecked(settings.isQuiteSleepServiceState());
      } else serviceToggleButton.setChecked(false);

      // Mute or hangup radio buttons check
      if (ConfigAppValues.getMuteOrHangup() == null) {
        MuteOrHangUp muteOrHangup = clientDDBB.getSelects().selectMuteOrHangUp();
        if (muteOrHangup != null) {
          if (muteOrHangup.isMute()) muteRButton.setChecked(true);
          else if (muteOrHangup.isHangUp()) hangUpRButton.setChecked(true);
        }
        // If MuteOrHangUp object is not created. Should not occur
        else {
          muteOrHangup = new MuteOrHangUp();
          clientDDBB.getInserts().insertMuteOrHangUp(muteOrHangup);
          clientDDBB.commit();
        }

      } else {
        if (ConfigAppValues.getMuteOrHangup()) hangUpRButton.setChecked(true);
        else muteRButton.setChecked(true);
      }
      clientDDBB.close();

    } catch (Exception e) {
      if (QSLog.DEBUG_E)
        QSLog.e(CLASS_NAME, ExceptionUtils.exceptionTraceToString(e.toString(), e.getStackTrace()));
    }
  }
  /**
   * This function save the user option regarding both mute or hang up in the ddbb.
   *
   * @param optionValue
   */
  private void saveMuteOrHangUpOption(boolean optionValue) {

    try {

      ClientDDBB clientDDBB = new ClientDDBB();
      MuteOrHangUp muteOrHangup = clientDDBB.getSelects().selectMuteOrHangUp();
      if (muteOrHangup != null) {

        // If is true, then the hangup option is established
        if (optionValue) {
          muteOrHangup.setHangUp(true);
          ConfigAppValues.setMuteOrHangup(true);
        }
        // If is false, then the mute mode is set to true
        else {
          muteOrHangup.setMute(true);
          ConfigAppValues.setMuteOrHangup(false);
        }

        clientDDBB.getUpdates().insertMuteOrHangUp(muteOrHangup);
        clientDDBB.commit();
      }

      // If MuteOrHangUp object is not created.
      else {
        muteOrHangup = new MuteOrHangUp();
        clientDDBB.getInserts().insertMuteOrHangUp(muteOrHangup);
        clientDDBB.commit();
      }
      clientDDBB.close();

    } catch (Exception e) {
      if (QSLog.DEBUG_E)
        QSLog.e(CLASS_NAME, ExceptionUtils.exceptionTraceToString(e.toString(), e.getStackTrace()));
    }
  }