I'm opening a Dialog
from within an Activity
. When the dialog opens, I call
((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
The problem is, when I close the dialog either by hitting a cancel button or clicking outside the dialog, the keyboard switches to a text keyboard and doesn't go away util I click the hardware back button. How can I dismiss the keyboard when the dialog is dismissed, and focus is returned to the previous window?