androidandroid-edittextwindow-soft-input-mode

How to enable the softInput on the editText


I disabled softInput on my editText using

public static void disableSoftInputFromAppearing(EditText editText) {
        editText.setRawInputType(InputType.TYPE_CLASS_TEXT);
        editText.setTextIsSelectable(true);
    }

But now I don't know how to enable it. A function to enable the softInput would be appreciated.


Solution

  • public void showSoftKeyboard(View view) {
        if (view.requestFocus()) {
            InputMethodManager imm = (InputMethodManager)
                    getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
        }
    }
    

    from this