views:

138

answers:

1

Hi,

Does anyone know if it's possible to have the adapter for an AutoCompleteTextView search a different field then what it returns to the text view to be inserted?

For example, I have a string that contains a phone number, an address, and a name. This works good for searching because I can enter any of those values to get what I want, but I only want the full name to be returned back to the TextView to be displayed?

Is this possible or does the adapter have to use the same value for both searching and returning to the AutoCompleteTextView?

Hope this makes sense, thanks for reading, Tony

A: 

This was much simpler than I thought it would be.

All you need to do is subclass either AutoCompleteTextView or MultiAutoCompleteTextView and override the replaceText method.

tonyc