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
  • 658
  • 2
  • 10
  • 31
Rahul Matte
  • 1,037
  • 1
  • 20
  • 46

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
  • 1,915
  • 14
  • 30