Looking at the Android documentation here:
https://developer.android.com/training/keyboard-input/style.html,
specifically:
EditText editText = (EditText) findViewById(R.id.search);
editText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_SEND) {
sendMessage();
handled = true;
}
return handled;
}
});
This does not close the keyboard after clicking the send button. It also does not close the keyboard if handled
is set to false
.
What is the appropriate way to hide the keyboard in this case?
Looking at :-
how to hide keyboard after typing in EditText in android?, there seems to be a multitude of ways. Is this really the way to go in Android?