示例#1
0
    /**
     * This function is called when an item in the command dropdown is selected. If the Manual
     * command is selected this function opens up a dialog for the user to enter the values to send
     * to the cat. Other wise it sends the command to the cat and updates the command display.
     *
     * @param parent - the AdapterView of the command dropdown.
     * @param view - the View of the spinner widget.
     * @param pos - the position in the array of selectable items that was accepted.
     * @param id - the id of the command dropdown
     */
    public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
      String command = parent.getItemAtPosition(pos).toString();

      if (command.equals("Manual")) {
        enterManualCommand();
      } else if (!command.equals("Select Command")) {
        Control.sendCommand(command);
        updateOutput();
      }

      parent.setSelection(0);
    }