Android Question Declaring members in Activity

Nitin Joshi

Active Member
Licensed User
My project includes 100 plus members. Names assigned to these members are like this A001, A002......A100, A101.....
Assigning so many members (100 plus lines) in sub Global seems very shabby way.
Is there any simple way to assign these members in few code lines?
 

Nitin Joshi

Active Member
Licensed User
Hi Erel, I am developing an APP which communicates to ESP8266. However my APP has 100 plus Buttons to send various commands to ESP8266...
These buttons are not distributed to different layouts. You can assume 20 buttons on Layout 1, 30 buttons on Layout 2 etc...
Now, my APP includes home page and has option to open layout. Say there are buttons having caption "Open Layout 1", "Open Layout 2" etc...
Based on option selected by home page, I am loading layout in one Activity model. I must declare all members in Global sub of the activity so there are 100 plus lines in Global sub. I would like to avoid the same.
Hope I could explain my project background.
Please be free and ask if any further details are required.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I would never add 100 variables for the buttons. There are better ways to organize the references.

You can for example add the information you need to the buttons Tag property, set the event name of all these buttons to be the same and use the Sender keyword to get the button that raised the event.

Watch the dynamic control video tutorial: https://www.b4x.com/etp.html
 
Upvote 0
Top