Using Spannable in MultiAutoComplete (TokenAutoComplete) - Android

392 Views Asked by At

I want to perform spanning on MultiAutoCompleteTextView in my android application. For that i have referred Splitwise TokenAutoComplete project and its working properly. They have created custom MultiAutoCompleteTextView for entering email id.here, whenever i select any item from dropdown, its added to custom token class. I want to fetch the entire content of that MultiAutoCompleteTextView, whether it is spannable text or simple text. For that if i write getText().toString(), it discards all spanned values and just return simple text without span. I want to get entire string written in this MultiAutoCompleteTextView along with spannables. If any one have used this control in their application or have any idea regarding this then please help me solve this issue. Thank you

Example :

Entered text : "@Marshall Wire and @Amanda"

Output of getText().toString : "@ and @" (marshall wire and Amanda are spanned objects which are discarded)

1

There are 1 best solutions below

0
Marshall Weir On

The simplest way to do this is to just use the output of getText() and replace the instances of @ with the objects from getObjects in order (though I would expect @@ instead of @ given how I implemented this...).