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)); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)