label names

FFMan

Member
Licensed User
Longtime User
If i have a label called lblMSG referenced in code, does it matter that I might have a label of the same name but on different layouts. (or is it like VB where the view/control is owned by the form).

Naturally I need to ensure only one is active at a time, but it is useful to have a status box on each layout, albeit in a different place.
 

Cableguy

Expert
Licensed User
Longtime User
Any propertie changes made in code will impact all the views with the same name...In Android, views are treated in a diferent maner than controls in WinMob...

I would suggest a prefix of some sort, to diferenciate the views...

ie. a label1 with Layout1 as a parent, you could try to use as the view name Layout1.label1... I havent tried this...
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
In Android the name we give to views is not as important as in Windows.
You can have several labels with:
- different names and different EventNames, in that case they are all different and independant and have different event routines.
- different names and the same EventName, in this case you must differentiate the labels with the Tag property, the names are no more known and there is 'only' one event routine for all the labels (with the same Eventname).
- same name and same EventName, same as above.
I your labels are in different Activities you can have same names and same EventNames because Activities are independant of each other in different modules.

Best regards.
 
Upvote 0
Top