So here we go.
1. Class CustomAutoComplete.java
This class is the main widget class that extends thet AutoCompleteTextView. You have to override 2 methods,
protected void replaceText(final CharSequence text)
protected void performFiltering(final CharSequence text, final int keyCode)2. You main layout file (main.xml)
3. Now we test it. This is your activity class.
Voila, you are done. Here’s a screenshot of our Custom Auto-Complete Text view at work.
You can also change the separator from the default “;” to any other character like a “,” or anything else.
On the adapter, you call the method setSeparator(String any);
Now you have your own custom auto-complete widget for Android.
For this particular example, however, Android provides you a widget by default. MultiAutoCompleteTextView is specifically designed to handle such kind of input.