java - Perform action when soft keyboard is closing -


i want perform method when soft keyboard closing. tried overriding onbackpressed() method didn't work because back-button changes when soft keyboard open (below screenshot of button).

hide-soft-keyboard-button

i tried using onkeylistener turned out doesn't work soft keyboard. , don't know keycode of "hide-soft-keyboard-button" either...

i appreciate since couldn't find solution anywhere.

you use layout listener see if root layout of activity resized keyboard detecting whether softkeyboard shown or has disappeared possible workarounds , hacks, hence not recommend it.

it more appropriate set focus change listener on edittext :

youredittext.setonfocuschangelistener(new onfocuschangelistener() { @override  public void onfocuschange(view v, boolean hasfocus) {     if (hasfocus) {         //got focus     } else {         //lost focus     }   } }); 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -