Moises Jimenez
Moises Jimenez

Reputation: 1962

Android: How to tell if the ok key of the keyboard was pressed?

Is there a way to know when the user hits the ok key on the keyboard?

Upvotes: 1

Views: 866

Answers (2)

CommonsWare
CommonsWare

Reputation: 1006819

Call setOnEditorActionListener() on your EditText, and your OnEditorActionListener will be called with onEditorAction() when the user presses the IME action key.

Note that not all IMEs have such a key, so do not count on this.

Upvotes: 3

hwrdprkns
hwrdprkns

Reputation: 7585

Try KeyEvent.FLAG_EDITOR_ACTION

From: http://developer.android.com/reference/android/view/KeyEvent.html#FLAG_EDITOR_ACTION

Upvotes: 0

Related Questions