Good day. Please tell me how I can catch the enter key and the transition to a new line in editText multilite.

I tried:

editText.setOnEditorActionListener( new OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if( event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER){ // обработка нажатия Enter return true; } return false; } }); 

Does not work.

  • You will not prompt where to interpose this in the code? what function? - Nikita Markov
  • In sense in what function? hang on that edittext, in which you need to intercept enter - pavlofff
  • But how to hang it. I declared EditText edittext; Where is this code next to it? in OnCreate or where? I just didn’t do it yet I don’t understand how it works - Nikita Markov
  • What has been done? Add the markup code to the question, where is the edittext and the activation code. - pavlofff
  • about what you have in the question, see this answer - pavlofff

0