oriharel oriharel - 1 year ago 146
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download