Possible Duplicate:
how to add button dynamically in android?
How to create dynamic UI for an activity? I should be able to add buttons by clicking add from the menu with desired name.
Possible Duplicate:
how to add button dynamically in android?
How to create dynamic UI for an activity? I should be able to add buttons by clicking add from the menu with desired name.
Insert the following code into the clickListener of your menu item
Button btn = new Button(this);
btn.setText("myDynamicButton");
layout.addView(btn);
You can check the following links for further information
http://androidforums.com/application-development/35582-adding-buttons-dynamically.html
https://groups.google.com/forum/?fromgroups=#!msg/android-developers/Ut-Q_J75OoM/n9siUXldslEJ