I\'m having trouble with the on screen keyboard. I have an activity with an EditText
which shows the keyboard, and a button to go to a second activity. The second a
Solved using a variation of the technique posted by phalt:
InputMethodManager im = (InputMethodManager) this.getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
im.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
This code works correctly during onCreate
/onStart
/onResume
, since doesn't rely on a focused view to get the window token from.