There are two methods: showSystemKeyboard and hideSystemKeyboard . I think everything is still logical, one method shows the keyboard, the other hides it.
The showSystemKeyboard keyboard show method in the onStart () method:
@Override public void onStart() { super.onStart(); if (allAvailableTags.isEmpty() && selectedTags.isEmpty()) { Utils.showSystemKeyboard(tagNameInputView); } } The showSystemKeyboard method showSystemKeyboard :
public static void showSystemKeyboard(EditText view) { if (view != null) { InputMethodManager inputManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); } } The task is to call the dialog in my class TagDialog, where the onStart () method is implemented, the keyboard opens immediately. Immediately say the constant SHOW_FORCED does not fit right away. Who cares why, follow here .
Tried as follows:
tagNameInputView.requestFocus(); tagNameInputView.postDelayed(new Runnable() { @Override public void run() { if (allAvailableTags.isEmpty() && selectedTags.isEmpty()) { InputMethodManager keyboard = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); keyboard.showSoftInput(tagNameInputView, 0); } } },200); tagNameInputView.requestFocus(); tagNameInputView.postDelayed(new Runnable() { @Override public void run() { InputMethodManager keyboard = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); keyboard.hideSoftInputFromWindow(tagNameInputView.getWindowToken(), 0); } },200); But you still have to click on the field before my keyboard opens.