[android-developers] Getting hold of a resource using generated string

2010-01-18 Thread Ray Benjamin
Ok, here's the problem. I have a layout file with 25 ImageButtons in in laid out in a 5x5 grid. During my application setup, I need to go through and add onClick and onLongClick handlers to each button and add the buttons to a local array. The problem is, I don't want to explicitly name every

Re: [android-developers] Getting hold of a resource using generated string

2010-01-18 Thread Mark Murphy
Try Resources#getIdentifier(). Ok, here's the problem. I have a layout file with 25 ImageButtons in in laid out in a 5x5 grid. During my application setup, I need to go through and add onClick and onLongClick handlers to each button and add the buttons to a local array. The problem is, I

Re: [android-developers] Getting hold of a resource using generated string

2010-01-18 Thread TreKing
Alternatively, you could just create and set up these 25 buttons in code. for (int i = 0; i R.attr.GRID_SIZE; ++i) { for (int j = 0; j R.attr.GRID_SIZE; ++j) { ImageButton button = new ImageButton(this); setupButton(button,i,j);

Re: [android-developers] Getting hold of a resource using generated string

2010-01-18 Thread Ray Benjamin
Thank you. I knew there had to be a way. Mark Murphy wrote: Try Resources#getIdentifier(). Ok, here's the problem. I have a layout file with 25 ImageButtons in in laid out in a 5x5 grid. During my application setup, I need to go through and add onClick and onLongClick handlers to each