I'm assuming you have 272 TextViews
, all with separate id's?
You can get an int id by a string like this...
public static int getIdByName(String name) {
return getResourceIdByName(name, "id");
}
public static int getResourceIdByName(String name, String type) {
StringBuilder s = new StringBuilder(context.getPackageName()).append(":").append(type).append("/").append(name);
return context.getResources().getIdentifier(s.toString(), null, null);
}
So for you, you could use the above and loop around all 272 TextViews and insert into a List<TextView>
like this:
List<TextView> results = new ArrayList<>();
for (int i = 1; i <= 272; i++) {
TextView textView = (TextView) getIdByName("resul" + i);
results.add(textView);
}