Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,

I am creating an application in which I am to display text as table. I am able to create rows sucessfully. I am adding multiple TextView in the newly created row. The issue I am facing is that the first added TextView is showing up however the remaining are not.

Any help is highly appreciated.

C#
String data = "test1,test2,test3\r\ntest4,test5,test6\r\n";
if(data != null)
        {
        	String[] datarow = data.split("\r\n");
        	
	        for(int i=0;i< datarow.length; i++)
	        {
	        	String[] datacol = datarow[i].split("[,|]+");
	        	TableRow row = new TableRow(this);
	        	row.setId(i);
	        	
	        	row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
	        	
	        	for(int j=0;j< datacol.length;j++)
	        	{
	        		TextView c = new TextView(this);
	        		c.setId(j);
	        		c.setText(datacol[j]);
	        		c.setPadding(3, 3, 3, 3);
	        		c.setLayoutParams(new LayoutParams(
	                        LayoutParams.FILL_PARENT,
	                        LayoutParams.WRAP_CONTENT));

	        		row.addView(c);
	        	}
	        	aTable.addView(row, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
	        }
        }
Posted
Updated 2-Nov-11 6:31am
v3
Comments
Umair Feroze 24-Oct-11 4:05am    
I am very much disappointed with CodeProject now. I had high hopes that someone will atleast ask me if the question is not cleared. Sadly none asked and none replied. It seems that Code project has a lack of Android programmers

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900