java - clear text view value while onclick is performed -
i have clear function still value not clear. may know how solve problem ?
public class abc extends menuactivity implements onclicklistener{ edittext et3; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.safebox_flow); et3 = (edittext)findviewbyid(r.id.edittext02); et3.settext(string.valueof('0')); et3.setonclicklistener(this); } @override public void onclick(view v){ //also here check edittext02 id thats set in xml layout if(v.getid() == r.id.edittext02){ et3.settext(""); } } }
i have double click can clear.
the below part of code goes oncreate method.
//here create sure **edittext02** id have declared in xml et3 = (edittext) findviewbyid(r.id.edittext02); //input type edittext02 number et3.setonclicklistener(this); public void onclick(view v){ //also here check edittext02 id thats set in xml layout if(v.getid() == r.id.edittext02){ et3.settext(""); } }
also ensure class implements onclicklistener
//example below public class mainactivity extends activity implements onclicklistener {
please comment below if still face problems. hope helps!
java android eclipse
No comments:
Post a Comment