android - Clearing a multiline EditText -


i trying clear multiline edittext field inside oneditoractionlistener.oneditoraction method.

but using of obvious ways i.e.

((edittext) view).geteditabletext().clear(); ((edittext) view).geteditabletext().clearspans();  ((edittext) view).settext(""); 

only clears visible characters - leaving the newlines in field (which have manually deleted).

is there way 'completely' clear multiline edittext field ? (or @ least - know why above don't work ?)

solved (in minute after night's sleep) - newline being added after clearing text because oneditoraction method implementation returning false (for other reasons).

returning true indicates 'enter' has been processed/consumed , clear() behaves expected:

edittext.setoneditoractionlistener(new oneditoractionlistener() {      @override     public boolean oneditoraction(textview view,int actionid,keyevent event) {            post(view.gettext().tostring());             ((edittext) view).geteditabletext().clear();             return true;          }      }); 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -