Search code examples
androidautocompleteletter

Immediately show autocomplete on Android


The Android autocomplete only starts after two letters. How can I make it so the list appears when the field is just selected?


Solution

  • To get the autocomplete to show on focus add focus listener and show the drop down when the field gets focus, like this:

    editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
      @Override
      public void onFocusChange(View view, boolean hasFocus) {
        if(hasFocus){
          editText.showDropDown();
        }
      }
    });
    

    Or just call editText.showDropDown() if you don't need the focus part.