Created
September 1, 2016 05:24
-
-
Save noaht11/f1db7eba94832e63a961b6ceeeb8d548 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void replaceText(CharSequence text) { | |
// Do nothing | |
} | |
@Override | |
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { | |
... | |
Object data = getDataForSuggestion(adapter, position); | |
CharSequence text = getFilter().convertResultToString(adapter.getItem(position)); | |
clearComposingText(); | |
int end = getSelectionEnd(); | |
Editable editable = getText(); | |
int start = mChipTokenizer.findTokenStart(editable, end); | |
editable.replace(start, end, mChipTokenizer.terminateToken(text, data)); | |
... | |
} | |
protected Object getDataForSuggestion(@NonNull Adapter adapter, int position) { | |
return adapter.getItem(position); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment