Android Question Create a dynamic button and his method

mrjaw

Active Member
Licensed User
Longtime User
Hi!
I need to create a few button depending of records in a table. I mean if I have 5 records in the table I will create 5 buttons. My problem is how can I create the name of any button and create the method/Sub for each button.
Ex:
for i=1 to 5
Dim "b" & i as Button
next

I have b1, b2...b5 as button
There is anyway to do this ?
 

Roycefer

Well-Known Member
Licensed User
Longtime User
Give them all the same event name and then use Sender inside the event sub to figure out which button triggered the event.

Also,
B4X:
Dim "b" & i as Button
won't work. Instead, create an array of Buttons and put some identifying info in their Tag properties.
 
Upvote 0
Top