SKen
SKen

Reputation: 662

MultiAutoComplete Selected items

i have a multiautocomplete text box which i populate with a list of contacts using a custom adapter. That is working. What i want to know is how do i get the list of selected items(i.e e-mails) from this? My autocomplete text box is like this

MultiAutoCompleteTextView act=(MultiAutoCompleteTextView)findViewById(R.id.attende_list);
     ContentResolver content = getContentResolver();
        Cursor cursor = content.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI,PEOPLE_PROJECTION, null, null, null);
        ContactListAdapter adapter = new ContactListAdapter(this, cursor, true);
        act.setThreshold(2);
        act.setAdapter(adapter);
        act.setTokenizer(
                new MultiAutoCompleteTextView.CommaTokenizer());

Where ContactListAdapter is my custom adapter for retrieving the contact mail ids.

Upvotes: 0

Views: 833

Answers (2)

Ram kiran Pachigolla
Ram kiran Pachigolla

Reputation: 21191

String[] toArr =   act.getText.toString().split(",");

for(int i=0;i<toArr.length;i++)
{
   System.out.println("Email is "+toArr[i]);
}

Check in logcat the list of emails are printed which you have selected.

Upvotes: 1

nandeesh
nandeesh

Reputation: 24820

I think you can directly get the string from TextView and split it to get array

String [] items = act.getText().toString().split(",");

Upvotes: 0

Related Questions