0

How to hide the SoftKeyboard from screen when edittext is accepting input from remote? I have tried

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInputFromWindow(editText.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY, 0);

It hides the softkeyboard but it also stops the edittext from taking input.

prabhakaran
  • 668
  • 2
  • 10
  • 33
Rahul Matte
  • 1,151
  • 2
  • 23
  • 54

1 Answers1

0

Use like this.

public static final void hideSoftKeyBoard(Context context, EditText editText) {
    InputMethodManager imm = (InputMethodManager) context
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}

Thanks

Imtiyaz Khalani
  • 2,037
  • 18
  • 32