I need to identify the event of back press which hide the softkeyboard
I have tested by override following methods 
- onKeydown
- onBackPressed
- onConfigurationChanged
- dispatchKeyEvent
But the controller is not reaching there
I need to identify the event of back press which hide the softkeyboard
I have tested by override following methods 
But the controller is not reaching there
Use dispatchKeyEventPreIme in subclassed EditText view:
@Override
public boolean dispatchKeyEventPreIme(KeyEvent event) {
    if(KeyEvent.KEYCODE_BACK == event.getKeyCode()) {
       //do what you need here
    }
    return super.dispatchKeyEventPreIme(event);
}
 
    
    An update to @Ludevik's answer
Firstly suggest overriding onKeyDown()
Secondly if the key press has been handled then return true not super.onKeyDown()
Updated code (in Kotlin):
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
    // if recognise the keyCode then process 
    return if (keyCode == desiredKeyCode) {
        // do what you need to do
        true // key press handled
    } else {
        super.onKeyDown(keyCode, event)
    }
}
As for closing the soft key board - My experience is that can prove problematic (leading to unexpected consequences)
