を使用して、TableRows 内にある TextViews の値を出力しようとしていますTableLayout#getChildAt(i).getChildAt(j)
。
上記を使用してログに記録しようとすると、logcat は、それが View オブジェクトであり、使用しようとしているメソッドを持っていない ( getText()
) と不平を言います。
TableRows の唯一のビューは TextViews です。
// List<TextView> textViewBoxes...
private void createViews() {
...
tblLayout = new TableLayout(this);
tblRow01 = new TableRow(this);
...
for (int i = 0; i < 99; i++) {
TextView text = new TextView(this);
text.setText("Player " + i);
textViewBoxes.add(text);
}
tblRow01.addView(textViewBoxes.get(0));
...
tblLayout.addView(tblRow01);
...
// Print the contents of the first row's first TextView
Log.d(TAG, ("row1_tv1: " +
tblLayout.getChildAt(0).getChildAt(0).getText().toString));
...
}