Search code examples
androidandroid-softkeyboard

ImeAction Search is changed to Done after tapping on it


I have an Edittext for searching on Listview.

I have set imeOption to 'IME_ACTION_SEARCH' so that soft-keyboard will show search key on it.

The problem is that when I tap on search key on keyboard if edittext contains no text in it, the search key changes to 'Done' instead of dismissing the keyboard.

If the Edittext contains some text in it the search key works well.

Keyboard before tapping on Search

Keyboard after tapping Search


Solution

  • I found the problem behind this. It was happening because the OnEditorAction Listener was not properly set on Edittext. Since listener was not properly set call was not reaching onEditorAction() method.