I have multiple edit text and button on screen, on every button click there are some validation if validation is successful then i have to hide keyboard. I have tried so many code but nothing work. Currently i am using,
InputMethodManager imm = (InputMethodManager) cntx.getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, 0);
This is toggle, it opens if keyboard is hidden, but i wants to hide keyboard whether it is open or not.