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

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -