android - Refreshing TextView in setOnClickListener -
i have textview
, button
implemented setonclicklistener
method. want click on button , update textview
, unfortunately happens in first click. can see used view.invalidate();
refresh view, not working. here code:
public class createtarget extends activity { button mbutton; textview board; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.createtarget); mbutton = (button)findviewbyid(r.id.submit); board =(textview)findviewbyid(r.id.board); mbutton.setonclicklistener(new view.onclicklistener() { public void onclick(view view) { string s=givetext(); // giving string based on computations board.settext(s); view.invalidate(); //refreshing view } });
first ,the view invalidating button , not textview. second, textview's visibility invisible or gone in first run? third, what's "tsubtarget"?
thanks.
Comments
Post a Comment