I would like to know how can I listen for the android soft keyboard clear button in my activity Kotlin class, so when the clear button is pressed I need to do something.
Thanks
CodePudding user response:
You can do it with setOnKeyListener()
editText.setOnKeyListener { v, keyCode, event ->
if(event.action == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_DEL){
// on clear do something
}
false
}