adam-mcneilly
04/19/2018, 8:39 PMtextWatcherListener has not been defined yet:
init {
TextView(applicationContext).addTextChangedListener(textWatcherListener)
}
val textWatcherListener = object: TextWatcher {
override fun beforeTextChanged(a: CharSequence?, b: Int, c: Int, d: Int) {
}
override fun onTextChanged(a: CharSequence?, b: Int, c: Int, d: Int) {
}
override fun afterTextChanged(a: Editable?) {
}
}
However, if I put textWatcherListener first, it works fine. That's okay, but I'm just trying to understand the technical explanation for why it has to be first and why it can't resolve it at compile time?