Last active
August 7, 2018 18:50
-
-
Save anitaa1990/473922afb15481549eba09e6c884eda9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
* There are 3 methods to the TextWatcher interface. | |
* But in most scenarios we need to use only one method. | |
* This means ideally the remaining two methods have no use and should | |
* not be part of the interface. This is in violation of the ISP principle | |
*/ | |
editText.addTextChangedListener(new 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) { | |
/* In most of the scenarios this is the only method we use. The other methods are pointless in these cases. */ | |
} | |
@Override | |
public void afterTextChanged(Editable editable) { | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment