helpME
helpME

Reputation: 1

What key gets pressed to hide soft keyboard in android

I'm trying to detect when the soft keyboard gets closed, I found this code snippet

@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
   if (event.getKeyCode() == KeyEvent.KEYCODE_BACK){
          //detects that keyboard was hidden
       }
       return super.onKeyPreIme(keyCode, event);
   }

but this needs to be added to a subclass that extends editText, I'm not intrested in implementing the functionality I want to add on keyboard hidden in all my app, I want to add it for just one Activity, I tried onKeyDown, onKeyBack, onKeyUp, onBackPressed nothing seems to log the back press that closes the soft keyboard.

so my question is there a way to detect the click on the button that hides the keybaord?

Upvotes: 0

Views: 245

Answers (0)

Related Questions