@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);

    if (created) {
      // Prevent overwriting attributes that are already set
      return;
    } else {
      created = true;
    }

    if (getArguments() != null) {
      ip = getArguments().getString(ARG_IP);
      type = TcpConnectionManager.ReceiverType.valueOf(getArguments().getString(ARG_TYPE));
      menu = getArguments().getInt(ARG_MENU);
    } else {
      Log.e(LOG_TAG, "onCreate: getArguments()==null");
      ip = "";
      type = TcpConnectionManager.ReceiverType.UNSPECIFIED;
      menu = 0;
    }

    tcpConnectionManager = TcpConnectionManager.getInstance(getActivity().getApplicationContext());

    connection = tcpConnectionManager.requireConnection(this);
  }
  public void setValues(String ip, TcpConnectionManager.ReceiverType type, int menu) {
    this.ip = ip;
    this.type = type;
    this.menu = menu;

    connection = tcpConnectionManager.requireConnection(this);

    int[] spinnerMenus = TcpConnectionManager.getDropdownMenuSubmenus(getResources(), type);
    String[] spinnerCommands =
        TcpConnectionManager.getDropdownMenuCommandValues(getResources(), type);
    String[] spinnerResponses =
        TcpConnectionManager.getDropdownMenuResponseValues(getResources(), type);
    String[] spinnerReadables = TcpConnectionManager.getDropdownMenuNames(getResources(), type);
    if (spinnerMenus.length != spinnerCommands.length
        || spinnerMenus.length != spinnerResponses.length
        || spinnerMenus.length != spinnerReadables.length) {
      Log.e(LOG_TAG, "setValues: Array lengths don't match");
      return;
    }
    for (int i = 0; i < spinnerMenus.length; i++) {
      if (spinnerMenus[i] == menu) {
        responseClassifier = spinnerResponses[i];
        command = spinnerCommands[i];
        submenuReadable = spinnerReadables[i];
        break;
      }
    }

    setSpinnerContent();
  }