I need the method or the action when the EditText changed. When the user write in EditText I want to have some action. How to do that?
Asked
Active
Viewed 484 times
3 Answers
0
I always do it with a TextWatcher, and overriding the afterTextChanged
like this:
mEditText.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) { }
@Override
public void afterTextChanged(Editable editable) {
String newText = editable.toString();
}
});

Tiago A.
- 2,568
- 1
- 22
- 27
0
There are three methods you can register
beforeTextChanged
onTextChanged
afterTextChanged
Example reference: Counting Chars in EditText Changed Listener