3

I'm using a custom ArrayAdapter to set the adapter on an AutocompleteTextView (AddressAdapter extends ArrayAdapter).

Because I'm using the dropdown list to show the addresses and the distance to the actual position, I have to parametrize the Array Adapter with Address.

The problem comes here: the method

public Address getItem(int position)

gives the selected item of the Addresses list. Due to I'm using Address as the Adapter base class when I click on one of the suggestions the TextBox is filled with the toString() representation of Address class.

How can I change this default behavior?

Thanks!

Javier Manzano
  • 4,761
  • 16
  • 56
  • 86
  • I am doing something similiar HERE!!! http://stackoverflow.com/questions/12854336/autocompletetextview-backed-by-cursorloader – Etienne Lawlor Oct 30 '12 at 19:38

1 Answers1

0

You can override the getView() method to change the default view of each item.

You can extract the TextView and since getView() also passes you the position, you can use that to retrieve the data object and manipulate the values that you are displayed.

Saad Farooq
  • 13,172
  • 10
  • 68
  • 94