Keyboard is not getting hidden while my app is moving in background in Marshmallow and some android OS. Here's my code
InputMethodManager imm = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromInputMethod(getWindow().getCurrentFocus()
.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);