autocomplete - How to Customize the View of AutoCompleteTextView in Android? -
autocomplete - How to Customize the View of AutoCompleteTextView in Android? -
i have autocompleteview user can search other users. user custom object consists of id, name. autocompleteview controller usersadapter. usersadapter handles setting view of user object in suggestion. how set autocompleteview search on user name? mean, autocomplete should work based on username.
you should utilize addtextchangedlistener
on autocompletetextview. after, utilize 1 of 3 methods provided phone call function treat list contains usernames.
here illustration :
recherche.addtextchangedlistener(new textwatcher() { @override public void beforetextchanged(charsequence charsequence, int i, int i2, int i3) { } @override public void ontextchanged(charsequence charsequence, int i, int i2, int i3) { if (charsequence.length() > 1) searchsuggestions(charsequence); } @override public void aftertextchanged(editable editable) { } });
for "search" method, can find many examples, in case, that's linked on bdd, utilize asynctask, if have list stored, utilize match function.
hoope helps.
android autocomplete
Comments
Post a Comment