Refactoring RadioGroup setter code?
Assuming that setT5RadioGroup only sets a variable within the fragment:

In your fragment, use RadioGroup[] radioGroups = new RadioGroup[10];

setTRadioGroup(int number, RadioGroup grp) {
   this.radioGroups[number] = grp;
}


In your activity, or whatever it is:

for (int i = 0; i &lt; rowids.length; i++) { // assuming rowids.length is 10
    RadioGroup grp = (RadioGroup)fragView.findViewById(rowids[i]).findViewById(R.id.t1_radiogroup);
    fragment.setTRadioGroup(i, grp);
}


Whenever you find yourself using multiple numbered methods that does very similar things, think: Array!! (or possibly List&lt;ElementType&gt; if you want to be able to add/remove dynamically)