code: public void setSelectedTime(int hour, int minute) {
          final int count = getAdapter().getCount() - 1;
          int itemPosition = -1;
          for(int i=0; i<count; i++) {
              final TimeItem item = ((TimeItem) getAdapter().getItem(i));
              if(item.getHour() == hour && item.getMinute() == minute) {
                  itemPosition = i;
                  break;
              }
          }
          if(itemPosition >= 0)
              setSelection(itemPosition);
          else {
              // create a temporary TimeItem to select:
              selectTemporary(new TimeItem(formatTime(hour, minute), hour, minute, NO_ID));
          }
      }
docs: Sets the Spinner's selection as time in hour and minute. If the time was not in the possible
  selections, a temporary item is created and passed to selectTemporary().
  @param hour The hour to be selected.
  @param minute The minute in the hour.