Android marshmallow edittext OnKeyListener not fired on enter button

Viewed 906

As the title says on MM devices Enter key is not recognized, the same code is working fine on 5.x. Any help here would be appreciated. Snippet of how i am using is:

 <EditText
        android:id="@+id/post_new_question_edittext_question"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:hint="@string/type_your_question_here"
        android:gravity="top"
        android:layout_weight="1"
        android:imeOptions="actionDone"
        android:inputType="textMultiLine"/>

Here is my listerner

  m_editText.setOnKeyListener(new View.OnKeyListener() {
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
                PostNewQuestion();
                return true;
            } else {
                return false;
            }
        }
        });
2 Answers
Related