i've a problem in android app written in Kotlin.
I've a textview that has a setOnFocusChangeListener and it worked fine as long as i've added an EndIconMode. Now in my layout i see the END_ICON_CLEAR_TEXT and this works, but nothing happens when this textview loses focus.
How can I made this works?
textInputLayout = LayoutInflater.from(activity).inflate(R.layout.textinputlayouttemplate, null) as TextInputLayout
val textView = CreateUI._TextView(castToField(field), textInputLayout.context)
if (field.validatefield || field.nextpage != 0)
{
textView.setOnFocusChangeListener { _, hasFocus ->
if (!hasFocus && !GlobalVar.drawerOpened)
{
if ((field.mandatory && !textView.text.toString().isNullOrEmpty()) || (!field.mandatory)) {
if (field.validatefield) {
validateField(field.fieldcode, textView.text.toString(), field.nextpage)
} else {
_goToNextPageNo = field.nextpage
goToNextPageIfExist()
}
}
}
}
}
textInputLayout.addView(textView, layout_wMATCHPARENT_hWRAPCONTENT)
textInputLayout.layoutParams = layout_wMATCHPARENT_hWRAPCONTENT
textInputLayout.setPadding(0, 0, 0, 0)
textInputLayout.endIconMode = TextInputLayout.END_ICON_CLEAR_TEXT
linearLayout.addView(textInputLayout)

