private void setSpinnerContent() {
   ArrayList<String> list = new ArrayList<>();
   spinnerItemNames =
       TcpConnectionManager.getCommandNameArray(getResources(), connection, menu, false);
   spinnerItemValues = TcpConnectionManager.getCommandValueArray(getResources(), connection, menu);
   list.addAll(Arrays.asList(spinnerItemNames));
   if (Util.SCREENSHOT) {
     if (list.isEmpty()) {
       spinnerItemValues = new String[] {""};
     } else {
       list.remove(0);
     }
     list.add(0, getString(R.string.fragment_spinner));
   }
   adapter =
       new ArrayAdapter<>(getActivity(), R.layout.support_simple_spinner_dropdown_item, list);
   spinner.setAdapter(adapter);
   updateUI(connection.getBufferedInformation(responseClassifier));
 }
 @Override
 public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
   if (command == null) {
     // Spinner not configured to control a device
     return;
   }
   TcpInformation information = connection.getBufferedInformation(responseClassifier);
   if (information != null) {
     spinner.setSelection(
         adapter.getPosition(
             information
                 .getStringValue())); // jump back to previous position so no wrong information is
                                      // displayed
   }
   if (spinnerActive) {
     if (information == null
         || !information.isStringAvailable()
         || !information.getStringValue().equals(spinnerItemNames[pos])) {
       connection.sendRawCommand(Util.createCommandChain(command, spinnerItemValues[pos]));
     }
   } else {
     spinnerActive = true;
   }
 }