0

I'm trying to assign an EventListener to a editText, but I didn't understand the conditions it used in EditorAcrion. obviously the second one is when the user released the key but I'm not sure about the event == null. could someone clear this up for me, please.

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (event == null || event.getAction() == KeyEvent.ACTION_UP) {
  adapter.add(v.getText().toString());
  v.setText("");
}
Yar
  • 7,020
  • 11
  • 49
  • 69
  • 2
    [In this question someone had a similar issue][1]. Apparently that happens since 3.0. [1]: http://stackoverflow.com/questions/11301061/null-keyevent-and-actionid-0-in-oneditoraction-jelly-bean-nexus-7 – Sarah Caixeta Aug 07 '14 at 02:22
  • yes I guess that is same problem. it is frustrating when you should memorize these things without any logic behind them. thank you. – Yar Aug 07 '14 at 02:25

0 Answers0