Based on the response of Asad Rao, I created this KOTLIN extension function.
fun TextView.onClickKeyboardDoneButton(funExecute: () -> Unit) {
this.setOnEditorActionListener { _, actionId, _ ->
when (actionId) {
EditorInfo.IME_ACTION_DONE -> {
funExecute.invoke()
true
}
else -> false
}
}
}
Use:
myEditText.onClickKeyboardDoneButton{myFunctionToExecuteWhenUserClickDone()}