how to catch 'next' button on soft keyboard of Android

陌路散爱 提交于 2019-12-03 14:32:46

Haven't tested it, but this should work

 some_edittext.setOnEditorActionListener(new OnEditorActionListener() {
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_NEXT) {
                some_button.performClick();
                return true;
            }
            return false;
        }
    });

I might be wrong but I don't think there is any implicit way of doing it. You would need to write your own EditorAction.

You need to monitor everything that the user enters and whenever he presses 'NEXT', you would have to manually shift the focus to the next EditText, using EditorInfo.IME_ACTION_NEXT.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!