I have a DialogFragment with an EditText and a “submit” Button. Why doesn't the keyboard automatically disappear when dismiss() is called from the Button code in the DialogFragment? Is there a natural, or at least intuitive or obvious way to dismiss/hide the keyboard?

Is there something along the lines of myEditText.hideKeyboard() that I just haven't been able to find?

Using the InputMethodManager is convoluted, setSoftInputMode isn't much more intuitive, setInputType(0) didn't hide the keyboard (it did change it from numeric to alpha), and clearFocus() / setFocusable(false) didn't do anything at all.

My best answers are easier to implement, but still not what I'm looking for:

1) Forget the "submit" button, just use the "done" key with IMEOptions="actionDone"; or

2) call myEditText.setEnabled(false)) before dismiss() in the Button code (I made the EditText a class variable for easy reference).

Is there a natural or intuitive solution?

0

There are 0 best solutions below