Why isn't the virtual keyboard closed properly
I'm running a program which is calling a mmSocket.connect()
-procedure in which a bluetooth pairing-process is start开发者_JAVA技巧ed. If the phones aren't paired a dialog shows up after the code is entered on the device I want to connect with.
Sometimes the connection breaks and the dialog is terminated leaving the keyboard visual in the background.
Haven't found a way to close that keyboard. Have already tried the following:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
which should work if you ask me...
As always, any help is appreciated
You can hide the keyboard with the following code:
InputMethodManager imm = (InputMethodManager) getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(triggeringView.getWindowToken(), 0);
where triggeringView is the view that has shown the keyboard
This is now listed as a bug, please see the following link for info:
Google Code issue - 18911
精彩评论