android - How change Table Rows from another method -


i have table rows @ 1st method 2 textviews

final tablelayout tl = (tablelayout) findviewbyid(r.id.mainlayout); final tablerow tr = new tablerow(this); tl.setstretchallcolumns(true); tl.setshrinkallcolumns(true); tr.setgravity(gravity.center);  tr.setlayoutparams(new tablerow.layoutparams(tablerow.layoutparams.fill_parent,tablerow.layoutparams.wrap_content));      textview textview = new textview(this);     textview.settext(nameone);     textview.settextcolor(color.black);     textview.settextsize(20);     textview.setgravity(gravity.start);     tr.addview(textview);       textview textview2 = new textview(this);     textview2.settext(nametwo);     textview2.settextcolor(color.black);     textview2.settextsize(20);     textview2.setgravity(gravity.end);     tr.addview(textview2);      tl.addview(tr, new tablelayout.layoutparams(             tablerow.layoutparams.fill_parent,             tablerow.layoutparams.wrap_content)); 

then trying get/change second textview in row, doesnt works. how permission changes table rows?

public void anothermethod(){     tablelayout tl = (tablelayout) findviewbyid(r.id.mainlayout);     tablerow t = (tablerow) v;      textview secondtextview = (textview) t.getchildat(1);     string secondtext = secondtextview.gettext().tostring();     log.d(log_tag, "second - " + secondtext); } 

*sorry english, hope you`ll understand question

i hope code below you.

public void anothermethod(){     tablelayout tl = (tablelayout) findviewbyid(r.id.table_layout);     int tablerowindex = 0;     tablerow tr = (tablerow) tl.getchildat(tablerowindex);     int textviewindex = 1;     textview textview = (textview) tr.getchildat(textviewindex);     textview.settext("new text"); } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -