keyevent - android SEND key crashes -
i have need check enter key start search routine. works except keyboards seem have send button instead of enter button. when pressed code dumps. have small sample below. ideas?
tx1.setoneditoractionlistener (new oneditoractionlistener() { @override public boolean oneditoraction(textview v, int actionid, keyevent event) { system.out.println("key: " + event.getkeycode()); //blows here if (event.getaction() == keyevent.action_down) { if (event.getkeycode() == keyevent.keycode_enter) { // ... } } } }
i believe event null in case. detecting send action on softkeyboard oneditoractionlistener should this.
oneditoraction(textview v, int actionid, keyevent event){ if(actionid == editorinfo.ime_action_send){ send(); } return false;// softkeyboard still close after pressing 'send' }
Comments
Post a Comment