Hey I am making an android app that will have ~256 buttons. Because I dont want to write the very same code for everyone of these I thought it might be possible to realize an easier solution via arrays. My approach in the onCreate to set the listeners was:
1 for (int i=1; i<32; i++)
2 {
3 button[i] = (Button)findViewById(R.id.button[i]);
4 button[i].setOnTouchListener(this);
5 }
I set the Button[] like that: Button[] button=new Button [64];
Now, eclipse tells me in line 3 "button cannot be resolved or is not a field" and it just underlines the word "button", so I think it ignores/just does not recognize the [i] (array)-stuff.
The rest of my code seems to get on with that perfectly because it gets recognized as an object (correct me if I said that wrong) but the findViewById() doesn't get on with it ..
Thanks for the replies, Alex