Processing the Ok button on the virtual keyboard

I need to press the Ok button on the virtual keyboard to trigger the check(View v) event and the keyboard does NOT close. How can this be done?

Author: edcft, 2020-06-11

1 answers

If it is an EditText you can use a similar method:

EditText editText = (EditText) findViewById(R.id.query);
editText.setOnEditorActionListener(new OnEditorActionListener() {
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId == EditorInfo.IME_ACTION_GO) {
            return true;
        }
        return false;
    }
});
 1
Author: Sergei Buvaka, 2020-06-11 15:21:18