Skip to content

Instantly share code, notes, and snippets.

@demixdn
Created May 25, 2017 12:58
Show Gist options
  • Save demixdn/fda6cacf981e54d84bf2e1187b67215d to your computer and use it in GitHub Desktop.
Save demixdn/fda6cacf981e54d84bf2e1187b67215d to your computer and use it in GitHub Desktop.
Simple TextWatcher for EditText
import android.text.Editable;
import android.text.TextWatcher;
/**
* @author Aleks Sander
*/
public abstract class SimpleTextWatcher implements 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) {
afterTextChanged(s.toString());
}
public abstract void afterTextChanged(String s);
}
@demixdn
Copy link
Author

demixdn commented May 25, 2017

Usage
editText.addTextChangedListener(new SimpleTextWatcher() { @Override public void afterTextChanged(String s) { Log.i(TAG, "afterTextChanged: " + s); } });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment