Possible Duplicate:
Add an array of buttons to a GridView in an Android application
I have Button List. I want to add these buttons in addition to current layout and also setOnclickListener to Button list. I can do how?
Possible Duplicate:
Add an array of buttons to a GridView in an Android application
I have Button List. I want to add these buttons in addition to current layout and also setOnclickListener to Button list. I can do how?
Something like that ?
ArrayList<Button> buttonList = new ArrayList<Button>();
buttonList.add(new Button("b1"));
buttonList.add(new Button("b2"));
buttonList.add(new Button("b3")); ...
for(Button b : buttonList) {
b.setOnclickListener(/*listener here*/);
}