Adding view at run time..

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Adding view at run time..

Postby Abhishek » Fri Jun 26, 2009 1:43 pm

first i add a table layout...thr xml file...
and add some rows with text view..
then i want to add some rows and view at run time.....using for loop as i want to add 3 rows....but i ma getting run time error...


TableLayout tb=(TableLayout)findViewById(R.id.MainLayout1);

for(int i=0;i<3;i++)
{
TableRow t=(TableRow)findViewById(R.id.TableRow01);




tb.addView(t);
}
plz......help
Abhishek
Junior Developer
Junior Developer
 
Posts: 13
Joined: Tue Jun 23, 2009 10:07 am

Top

Postby Emmanuel7 » Fri Jun 26, 2009 10:11 pm

This is what I'm doing for that :

TableRow CurRow = new TableRow( WordProspectorActivity );
<... Stuff with the row ...>
tb.addView(CurRow);
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests