Created
June 5, 2020 11:44
-
-
Save TheBotBox/2942f7be48246e05fe52e6993eb777d1 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
fun EditText.onTextChanged(listener: (String) -> Unit) { | |
this.addTextChangedListener(object : TextWatcher { | |
override fun afterTextChanged(s: Editable?) { listener(s.toString()) } | |
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} | |
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment