Search code examples
codenameone

How to add listener on "Enter" button in the virtual keyboard?


Instead of hiding keyboard I would like to tight an action listener to the Enter button. To my understanding, it might have different behavior on iOS and Android, as well as it might be not very reliable.

I will appreciate any suggestions.


Solution

  • You can use setDoneListener on text components e.g.:

    myTextField.setDoneListener(e -> doSomething());