Using java for Android, I have come across a problem:
for(int a = 0; a < 26; a++){
textViewArray[a] = (TextView) findViewById(R.id.(alphabet[a]));
}
I have 26 TextViews in an xml file with the ids A, B, C, D, ...Z I need the above to become R.id.A, R.id.B, R.id.C, ...R.id.Z when it is run. The above is one of my attempts which for obvious reasons doesn't work. I have thought of using
int[26] = new int[]{R.id.A, R.id.B, R.id.C .... R.id.Z};
then using those array entries in the above for loop but is there a neater way to do it? Possibly converting a string ( "R.id." + (alphabet[a]) ) to code and letting it run as usual to find the id?
P.S. alphabet is a String array containing A, B, C ... Z in the above example
TextViews? That sounds a bit silly. Are you sure you shouldn't be using anAdapterView; i.e. aListView?