Ответ 1
См. getIdentifier
. В принципе, вы хотите что-то вроде:
for (int i=0; i<100; i++) {
int resId = getResources().getIdentifier("textView" + i, "id", getPackageName());
TextView textView = (TextView) dialog.findViewById(resId);
}
TextView textView1= (TextView) dialog.findViewById(R.id.textView1);
Мне нравится создавать что-то вроде этого:
for (int i=0; i<100; i++) {
TextView textView= (TextView) dialog.findViewById(R.id.textView+i);
}
как я могу это сделать?
Лесли
См. getIdentifier
. В принципе, вы хотите что-то вроде:
for (int i=0; i<100; i++) {
int resId = getResources().getIdentifier("textView" + i, "id", getPackageName());
TextView textView = (TextView) dialog.findViewById(resId);
}