Using this code will allow you to set up a multi-line
EditText where pressing the Return key on the virtual keyboard will remove focus from the
EditText, thereby preventing the user from entering a newline character.
mContent we set the raw input type as
TYPE_CLASS_TEXT, IME Options as
IME_ACTION_DONE to set up the Return key on the virtual keyboard as a DONE action. We also label the return key using
OnEditorActionListener lets us listen for actions on the keyboard. The giant nested if-statement is mostly empty because we only really need to check for a null event and
IME_ACTION_DONE, since we set it earlier in the IME Options. I left the statements in to show you how it would look if you wanted to handle things differently.
NOTE: This has not been tested for hardware keyboards, but if you have tested it I would love to know if you found that it works.