1. Download our Official Android App: Forums for Android!

Apps Create UI Items Dynamically and Call them

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

  1. Gamesterdude

    Gamesterdude Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Aug 5, 2010

    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 Android Expert
    Rank:
    None
    Points:
    163
    Posts:
    1,930
    Joined:
    Jul 13, 2010

    Jul 13, 2010
    1,930
    457
    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...