I need to create a MultiAutoCompleteTextView with the phone numbers of the contacts on a user's device. What I need is similar to gmail; except with gmail email addresses are used. For the contacts, I have the following needs:
each phone number must be an entry. So if John has 3 numbers (home, cell, work), they show as 3 entries
each entry is searchable by phone number or by first/last name of person
To create my adapter, I try to modify the one provided by Google but when I download the sample, it does not compile (kind of a crappy experience when the thing is right out of the box, but I am trying troubleshoot it). Then using the sample at http://developer.android.com/reference/android/widget/MultiAutoCompleteTextView.html I will bound my MultiAutoCompleteTextView to the adapter. At this point, I am not sure how to convert the adapter to match my needs (i.e. search contacts by name or phone and to retrieve the numbers). So my call for help is this: has anyone successfully done this and don't mind sharing their code? Or Does anyone know how I can modify the linked adapter to give me phone numbers, which I can search by name or phone? And third, will the adapter work with MultiAutoCompleteTextView?
Note
In asking this question, I have made certain assumptions on how Google is implementing their MultiAutoCompleteTextView for emails. Does anyone know if that code is open source? Does anyone know if my assumptions are correct? Will my idea for implementing my contact phone MultiAutoCompleteTextView work?
UPDATE
So I have come a long way since asking the question. I am now using the answer at AutoComplete with name and number as in native sms app Android . But I am trying to convert the implementation to MultiAutoCompleteTextView but it's not allowing for multiple entries. Does anyone know how I might finish this?
UPDATE 2
Refer to AutoComplete with name and number as in native sms app Android :
My MultiAutoCompleteTextView is presently kind of working: it's allowing for multiple entries. I simply replaced AutoCompleteTextView
with MultiAutoCompleteTextView
, and I ignored the other answer's onItemClick
suggestion. It's working, kind of. Except, the data I get is not the nice formatted elements that you see in the gmail EditText
. So back to the original question: how is Google doing it? I don't want to spend time explaining how the gmail compose editText looks as the relevant reader can readily verify this. In their EditText
I can enter four contacts and then with random access click on one to delete it. I want to be able to do that. How?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…