I want to realize that as I enter text into EditText, values ​​(like variants, in my case of cities) are displayed in a ListView.

But I can't find the EditText component that I need from the listeners. Is it even possible to do this? (The data will be loaded from a remote MySQL) and is it worth it at all?

  • what is the EditView component, there is no such API in the Android API - pavlofff
  • @pavlofff, should be the author meant EditText. It is he who is listed in the tag, although a certain editview appears in the question itself - A. Shakhov
  • @ A.Shakhov yes, I meant edittext - danilshik
  • @ x0r, but there you can only display the preset values, don't I load the entire base of cities in it? - danilshik

1 answer 1

To set the listener for the EditText field, you can set the TextWatcher by passing it as a parameter to the addTextChangedListener method:

 awesomeEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { } });