1

I have this EditText :

<EditText
    android:id="@+id/name"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="@string/name"
    android:inputType="textCapSentences"
    android:gravity="center"
    android:imeActionId="@+id/action_done"
    android:imeOptions="actionDone">

    <requestFocus/>

</EditText>

and this is the code inside my class that extends Dialog :

name.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            Log.d(TAG, "name action performed");
            if (actionId == R.id.action_done) {
                ok.performClick();
                return true;
            }
            return false;
        }
    });

I am looking to perform a custom action when the editor button is clicked, namely call the OnClick() method of the ok button.

However, onEditorAction() never gets called.

What am I doing wrong?

kimv
  • 1,569
  • 4
  • 16
  • 26
  • Is your onEditorAction really not being called or is the statement if (actionId == R.id.action_done) just not being met? http://stackoverflow.com/questions/11301061/null-keyevent-and-actionid-0-in-oneditoraction-jelly-bean-nexus-7 – Kristy Welsh Jan 25 '16 at 20:52
  • onEditorAction() is never called – kimv Jan 25 '16 at 21:00

1 Answers1

0

Where is your editor button?

onEditorAction() would be called when enter button is pressed on the keyboard

beef
  • 11
  • 1