I need to listen to events on a EditText
- when users start typing
- and when focus is lost
I tried this and it does not work. What have I got it wrong?
etTo.setOnKeyListener(new OnKeyListener(){
public boolean onKey(View v, int keyCode, KeyEvent event) {
if(event.getAction() ==KeyEvent.ACTION_DOWN){
etTo.setText("");
}
return false;
}
});
For the first one you could try this:
for second one try this: