0

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.

halfer
  • 19,824
  • 17
  • 99
  • 186
ChanChow
  • 1,346
  • 7
  • 28
  • 57
  • Check this [link](http://stackoverflow.com/questions/1851633/how-to-add-button-dynamically-in-android) out – chRyNaN Nov 04 '12 at 19:36

1 Answers1

1

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

Korhan Ozturk
  • 11,148
  • 6
  • 36
  • 49