My activity implements KeyListener, and my edittext has a set of key listeners.
editor = new EditText(this);
editor.setMinLines(4);
editor.setMinimumWidth(400);
editor.setKeyListener(this);
When the user types something and presses "enter" on the on-screen keyboard, the text of the text text is set to the user's input.
@Override
public int getInputType() {
return InputType.TYPE_TEXT_FLAG_MULTI_LINE;
}
@Override
public boolean onKeyDown(View view, Editable text, int keyCode,
KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_ENTER){
outview.setText(editor.getText());
}
return true;
}
Here outview is a TextView. My problem is that in this action the physical return button does not work. Click it and nothing will happen. Any advice would be appreciated.
user485498
source
share