<@U5TPBQR6J> commented on <@U5R2X53DK>’s file <htt...
# android
u
@borisdamato commented on @thatsmoodi’s file https://kotlinlang.slack.com/files/U5R2X53DK/F5XSHGEGY/-.txt: use this one:
Copy code
fun EditText.beforeTextChanged(beforeTextChanged: (s: CharSequence?, start: Int, count: Int, after: Int)->Unit) {
    this.addTextChangedListener(object: TextWatcher {
        override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
            beforeTextChanged.invoke(s, start, count, after)
        }

        override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}

        override fun afterTextChanged(s: Editable?) {
        }
    })
}