Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You have to make custom autocompleteview by extending class.. and code mentioned in your question to be changed.</p> <pre><code>public class CustomAutoComplete extends AutoCompleteTextView { private String previous = ""; private String seperator = "@"; boolean isState = false; public CustomAutoComplete(final Context context, final AttributeSet attrs, final int defStyle) { super(context, attrs, defStyle); this.setThreshold(1); } public CustomAutoComplete(final Context context, final AttributeSet attrs) { super(context, attrs); this.setThreshold(1); } public CustomAutoComplete(final Context context) { super(context); this.setThreshold(1); } /** * This method filters out the existing text till the separator and launched * the filtering process again */ @Override protected void performFiltering(final CharSequence text, final int keyCode) { String filterText = text.toString().trim(); String lastchar = filterText.substring(filterText.length() - 1, filterText.length()); if (filterText.length() == 1) { if (lastchar.equals(seperator)) { isState = true; } else { isState = false; } } previous = filterText.substring(0, filterText.lastIndexOf(getSeperator()) + 1); filterText = filterText.substring(filterText .lastIndexOf(getSeperator()) + 1); if ((lastchar.equals(seperator)) || isState) { super.performFiltering(filterText, keyCode); isState = true; } } /** * After a selection, capture the new value and append to the existing text */ @Override protected void replaceText(final CharSequence text) { isState = false; super.replaceText(previous + text);// + getSeperator()); } public String getSeperator() { return seperator; } public void setSeperator(final String seperator) { this.seperator = seperator; } } </code></pre> <p>Hope this will help you...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload