[Solved] ANDROID: How can I set up buttons in a for loop?

[ad_1]

You do not need to do anything in the XML file. This can all be done in a class.

for(int i=0; i < x; i++) // where x is the size of the list containing your alphabet.
{
   Button button = new Button(this);
   button.setId(i);
   yourView.add(button);
}

1

[ad_2]

solved ANDROID: How can I set up buttons in a for loop?