This is the section of code:
int buttonXa = 0, buttonXb = 4, layoutNum = (buttonXb - 1);
String layoutXNum = String.valueOf(layoutNum);
String layoutX;
LinearLayout layoutXab;
do {
layoutX = "ll" + layoutXNum;
layoutXab = (LinearLayout)layoutX;
buildButtons(layoutXab, buttonXa, buttonXb);
buttonXa += 4;
buttonXb += 4;
layoutNum += 1;
} while (buttonXa < 12);
Why doesn't the casting work? What is the correct code?HI there @J.Knight and any others This code is trying to send to the "build buttons" function, a linear layout, whose name is built dynamically within a "do while" loop, the first time the layout is called ll3 then ll4 and so on...The name was built and put into a String variable, but now needs to be converted to a Linear Layout variable... Thanks Emuna