Jerome Campeaux Jerome Campeaux - 1 year ago 87
Android Question

Java Android table not displayed

I made the following code :

TableLayout tableLayout = (TableLayout) tmpView.findViewById(;
TableRow tableRow;
TableLayout.LayoutParams lp = new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT);
for (int i = 0; i < modules.length(); i++) {
tableRow = new TableRow(this.getActivity());
tableRow.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
TextView title = null;
TextView grade = null;
try {
title = new TextView(this.getActivity());
grade = new TextView(this.getActivity());
} catch (JSONException e) {
tableLayout.addView(tableRow, lp);

But nothing displayed on the screen.

Do you know why it's not working ?

Answer Source

Solution found, TableLayout declared dynamically then set on the view

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download