//class MainActivity : AppCompatActivity()
private lateinit var etX : EditText
private lateinit var etY : EditText
private lateinit var etZ : EditText
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
etX = findViewById(R.id.etX)
etY = findViewById(R.id.etY)
etZ = findViewById(R.id.etZ)
val textWatcher = object : TextWatcher {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
println("onTextChanged = '$s'")
}
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {
}
override fun afterTextChanged(s: Editable) {
println("afterTextChanged = '$s'")
}
}
etX.addTextChangedListener(textWatcher)
etY.addTextChangedListener(textWatcher)
etZ.addTextChangedListener(textWatcher)
}
При изменении текста в EdiText’ах не срабатывают обработчики событий в TextWatcher.
Почему не работают и как исправить?