How to show software keyboard when focusing textedit in Android

To show software keyboard when focusing textedit in Android you can use the snippet below.

Sample Java

myTextEdit.setOnFocusChangeListener(new View.OnFocusChangeListener() {
    @Override
    public void onFocusChange(View view, boolean focus) {
        if (focus) {
            dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
        }
    }
});

Please Share us:
Please rate this snippet

3 thoughts on “How to show software keyboard when focusing textedit in Android

Leave a Reply