android - null keyevent and actionid = 0 in onEditorAction() (Jelly Bean / Nexus 7) -


i have edit text functions search box in application. in jelly bean on nexus 7 when type text box listening on , hit enter keyevent = null , actionid = 0 passed oneditoraction() method. has else encountered this? i'm thinking might bug.

in second if statement below null pointer because actionid = 0 , keyevent = null;

// search field logic. @override public boolean oneditoraction(textview v, int actionid, keyevent event) {     log.d(tag, "oneditoraction");     if (event != null && event.getaction() != keyevent.action_down)         return false;     if (actionid == editorinfo.ime_action_search             || event.getkeycode() == keyevent.keycode_enter) {               .....do stuff();      } } 

ended adding in null check keyevent. commonsware pointing out happens on 3.0+. seems more workaround solution, works.

// search field logic. @override public boolean oneditoraction(textview v, int actionid, keyevent event) {     log.d(tag, "oneditoraction");     if (event != null && event.getaction() != keyevent.action_down) {         return false;     } else if (actionid == editorinfo.ime_action_search         || event == null         || event.getkeycode() == keyevent.keycode_enter) {               .....do stuff();     } } 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -