I'm making a calculator for just a practice, but I found that there are so many buttons. I named their id like button+row+col ex) row=5, col=4 -> id=button54
Since I have to attack listener to every button, I found it very annoying things to do this manually. Like,
findViewById(R.id.button11).setOnClickListener(this);
findViewById(R.id.button12).setOnClickListener(this);
...
findViewById(R.id.button95).setOnClickListener(this);
Can I do this like
for(int i=1; i<=9; i++){
for(int j=1; j<=5; j++){
findViewById(R.id."button"+Integer.toString(i) + Integer.toString(j)).setOnClickListener(this);
}
}
or other way to make this easier.