I have a vertical linear layout of about 40 checkboxes and the java part has an array that has the content of these checkboxes. Is there a way to reduce the java code?
public String[] sur= {"A","B", //about 40 elements};
CheckBox cb1 = (CheckBox) findViewById(R.id.s1);
cb1.setText(sur[0]);
CheckBox cb2 = (CheckBox) findViewById(R.id.s2);
cb2.setText(sur[1]);
CheckBox cb3 = (CheckBox) findViewById(R.id.s3);
cb3.setText(sur[2]);
// repeated about 40 times