1. Check out our companion app, Forums for Android! Download from Google Play

Create UI Items Dynamically and Call them

Discussion in 'Application Development' started by Gamesterdude, Aug 6, 2010.

  1. Gamesterdude

    Gamesterdude New Member
    Thread Starter
    5

    Aug 5, 2010
    2
    0
    5
    There are threads similar but not quite what I am looking for.
    I want to be able to create buttons dynamically during run time when the user clicks the "New" button inside the menu.
    I then need a way to dynamically name these buttons so i can call them for individual actions.
    Any code or tips would be helpful. I know in c++ i would just create an integer counter and use that to name new items using string conversion but i dont think i can do that here.
     

    Advertisement

  2. jonbonazza

    jonbonazza Well-Known Member
    163

    Jul 13, 2010
    1,934
    459
    163
    Male
    You do this just like you would in normal java. Create an instance of the Button class and then set its properties via the particualr methods and then add it to a layout.
     

Share This Page

Loading...