I declared EditText programmatically (i.e. not in XML) and want to apply the OnKeyDown handler to it. The code shown does not work. Context: I'm trying to grab a short line from the keyboard that should not include control characters (I started with the Enter key). Maybe there is a better way?
Thank!
public EditText ttsymbol;
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_ENTER:
return true;
}return false;
}
source
share