I've activity has an editText, I wanna check entered text on the run, if text equals "1" then things r gonna change .. how to make this in Kotlin??
fun EditText.afterTextChanged(afterTextChanged: (String) -> Unit) {
this.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
textView9.visibility = View.GONE
spin7.visibility = View.GONE
spin8.visibility = View.GONE
spin9.visibility = View.GONE
}
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
val Edit = editText.text.toString()
if (Edit.equals("1")){
textView9.visibility = View.GONE
spin7.visibility = View.GONE
spin8.visibility = View.GONE
spin9.visibility = View.GONE
}
else {
textView9.visibility = View.VISIBLE
spin7.visibility = View.VISIBLE
spin8.visibility = View.VISIBLE
spin9.visibility = View.VISIBLE
}
}
override fun afterTextChanged(editable: Editable?) {
}
})
}