Code example for TableRow

Methods: setId, setLayoutParams

0
        int row, column;
        Context appContext = getApplicationContext();
 
        for(row = 0; row <= (end - start); row++) {
            // Create a TableRow row. 
            TableRow aRow = new TableRow(appContext);
            aRow.setId(row);
            aRow.setLayoutParams(widthHeightSettings);
            numberContainer.addView(aRow);
 
            for(column = 0; column < 3; column++) {
                // Create a TextView column, and place it in the just-created TableRow row. 
                TextView aNumber = new TextView(appContext);
                // aNumber.setLayoutParams(widthHeightSettings); 
                // Fails. I don't know why. 
                aNumber.setText(Double.toString(Math.pow(start + row, 1 + column)));
                ((TableRow) numberContainer.findViewById(row)).addView(aNumber);
            } 
        } 
    } 
Experience pair programming with AI  Get Codota for Java