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("");
}