Android: Action listener on EditText change

8 09 2012

If business logic requires to trigger any kind of action right after the user changes text in EditText View, the TextWatcher listener can be used. Good example of use is filter, that updates when user provides filtering criteria.

Add textChanged listener to EditText:


Implement listener to perform desired actions:

TextWatcher onSearchFieldTextChanged = new TextWatcher(){
	public void afterTextChanged(Editable s) {
		//your business logic after text is changed
	public void beforeTextChanged(CharSequence s, int start, int count, int after){
		//your business logic before text is changed

	public void onTextChanged(CharSequence s, int start, int before, int count){
		//your business logic while text has changed

Did I help you?
I manage this blog and share my knowledge for free sacrificing my time. If you appreciate it and find this information helpful, please consider making a donation in order to keep this page alive and improve quality

Donate Button with Credit Cards

Thank You!




2 responses

4 01 2013

thank you

15 05 2019

legalrc Отзывы – legalrc юг, legalrc onion

Give Your feedback:

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: