I want the TextView change at the same time depending on the number the user enters in EditText .
I found the TextWatcher class, but in my opinion, it can read the number of characters, not their values.

    1 answer 1

    You find the right tool and he can do what you need. Use something like this:

     final TextView textView = ...; final EditText editText = ...; editText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { textView.setText(s.toString()); } }); 
    • Can you explain how it works?)) I still don’t fully understand how many articles I haven’t read. For example, what is s in syntax. - Aleksandr Kim
    • one
      @AleksandrKim is the string that resulted from the change. In my opinion, this is quite obvious (and for this reason you could not find information on this subject :) you can always look into the implementation of the methods and look there. - Eugene Troyanskii