oriharel oriharel - 9 months ago 44
Android Question

How to catch a "Done" key press from the soft keyboard

how do I catch specific key events from the soft keyboard?
specifically I'm interested in the "Done" key.


Note: This answer is old and no longer works. See the answers below.

You catch the KeyEvent and then check its keycode. FLAG_EDITOR_ACTION is used to identify enter keys that are coming from an IME whose enter key has been auto-labelled "next" or "done"

if (event.getKeyCode() == KeyEvent.FLAG_EDITOR_ACTION)
    //your code here

Find the docs here.