Setting Image Button Via It's Id Into A 8x8 2d Array. Android. Xamarin
I have made a 2d array of size 8 and 8 respectively, and i have made 64 image buttons, each with a b1, b2 b3 id. I would love to set the id into the array. An example would be: b
Solution 1:
Yes, you can get the ID of the button dynamicaly and fill your array:
int overallCounter = 1;
for (int i = 0 i < 8; i ++) {
for (int j = 0;j < 8; j++ ) {
buttons[i, j] = FindViewById(Resources.GetIdentifier("b" + overallCounter, "id", this.PackageName));
overallCounter++;
}
}
Post a Comment for "Setting Image Button Via It's Id Into A 8x8 2d Array. Android. Xamarin"