/**
   * Implemented method from BaseAdapter class. This is the main method for returning a View which
   * corresponds to a row in the list. This calls the getItem() method to get the data. It is called
   * multiple times by the ListView and may be improved on by saving the previous result.
   */
  public View getView(int position, View convertView, ViewGroup parent) {

    View container = null;

    AttributeItem item = (AttributeItem) getItem(position);

    // check field type
    // TODO if you want to support domains, add checks here and use the
    // createSpinnerViewFromArray to create spinners
    if (item.getField().getName().equals(this.typeIdFieldName)) {
      // This is the featurelayers type field

      container = lInflator.inflate(R.layout.item_spinner, null);
      // get the types name for this feature from the available values
      String typeStringValue = this.typeMap.get(item.getValue().toString()).getName();
      Spinner spinner =
          createSpinnerViewFromArray(container, item.getField(), typeStringValue, this.typeNames);
      item.setView(spinner);

      // TODO set listener to change types associated domain fields if
      // required

    } else if (FieldType.determineFieldType(item.getField()) == FieldType.DATE) {
      // create date picker for date fields

      container = lInflator.inflate(R.layout.item_date, null);
      long date = Long.parseLong(item.getValue().toString());

      Button dateButton = createDateButtonFromLongValue(container, item.getField(), date);
      item.setView(dateButton);

    } else {
      // create number and text fields
      // View object for saving in the AttrbuteItem once it has been set
      // up, for
      // accessing later when we apply edits.
      View valueView = null;

      if (FieldType.determineFieldType(item.getField()) == FieldType.STRING) {

        // get the string specific layout
        container = lInflator.inflate(R.layout.item_text, null);
        valueView = createAttributeRow(container, item.getField(), item.getValue());

      } else if (FieldType.determineFieldType(item.getField()) == FieldType.NUMBER) {

        // get the number specific layout
        container = lInflator.inflate(R.layout.item_number, null);
        valueView = createAttributeRow(container, item.getField(), item.getValue());

      } else if (FieldType.determineFieldType(item.getField()) == FieldType.DECIMAL) {

        // get the decimal specific layout
        container = lInflator.inflate(R.layout.item_decimal, null);
        valueView = createAttributeRow(container, item.getField(), item.getValue());
      }

      // set the rows view onto the item so it can be received when
      // applying
      // edits
      item.setView(valueView);
    }

    return container;
  }