How to detect when Android software keyboard is hidden?

I need to determine when the Android soft keyboard is hidden. Currently my activity is responding to a hidden hardware keyboard, but the software keyboard looks like it can only be used if it is resized.

Does anyone know how a view or activity can be notified when a software keyboard is hidden by a user who cancels keyboard mode?

+4
source share
3 answers

Would sof tkeyboard always be visible help?

You can add this to your xml Activity file to ensure that the on-screen keyboard is always visible in this Control:

android:windowSoftInputMode="stateAlwaysVisible" 

http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft

+2
source

There is no real way to check, but you can check if this action works or not.

 boolean isClosing = false; InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); isClosing = imm.hideSoftInputFromWindow(tabHost.getApplicationWindowToken(), 0); 

This will return false if the keyboard was closed and true if it was open and is now closed.

+1
source

I solved this by simply finding the rear key. When the return key is received, I know that the soft keyboard will be canceled.

0
source

All Articles