Here's my scenario. I want to integrate into an EditText a search function. But I don't want it to be an external button, I want to call that function as I type in the EditBox.
How can I achieve this ? Thank you.
You need a TextWatcher
for your EditText
. The three callbacks are called when the text, in the attached EditText
changes
yourEditText.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) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
});
you can find more details on the documentation, here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With