Created
May 9, 2016 12:56
-
-
Save ksu3101/559c3cd033f1b715b44b47b60b487f80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TextWatcherAdapter | |
implements TextWatcher { | |
private final EditText view; | |
private final TextWatcherListener listener; | |
public TextWatcherAdapter(EditText editText, TextWatcherListener listener) { | |
this.view = editText; | |
this.listener = listener; | |
} | |
@Override | |
public void onTextChanged(CharSequence s, int start, int before, int count) { | |
listener.onTextChanged(view, s.toString()); | |
} | |
@Override | |
public void beforeTextChanged(CharSequence s, int start, int count, int after) { | |
// pass | |
} | |
@Override | |
public void afterTextChanged(Editable s) { | |
// pass | |
} | |
public interface TextWatcherListener { | |
void onTextChanged(EditText view, String text); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment