Wish get view name

Cableguy

Expert
Licensed User
Longtime User
In android, views have no "name", they have a "reference".
Imagine you add a view, say a button, to an activity, and you name it button1.
You can latter delete it from its parent and add it to another, like, take it from a panel and put it into another... For YOU it is still Button1, but for the OS, the "reference" is something completely different from the previous one it was given. Also, imagine that your view is part of a secondary activity, and that, due for it being in the background long enough, the SO decides decided to clear the resources used with that activity... The next time you call that activity, all views references will be completely different from when it first started...
 

mauro vicamini

Active Member
Licensed User
Longtime User
In android, views have no "name", they have a "reference".
Imagine you add a view, say a button, to an activity, and you name it button1.
You can latter delete it from its parent and add it to another, like, take it from a panel and put it into another... For YOU it is still Button1, but for the OS, the "reference" is something completely different from the previous one it was given. Also, imagine that your view is part of a secondary activity, and that, due for it being in the background long enough, the SO decides decided to clear the resources used with that activity... The next time you call that activity, all views references will be completely different from when it first started...
Thanks a lot for your explanation!
But i think that B4A is somthing at a level higher than plain Java/Android and I was thing that inside his framework could be some kind of collection that could reference the reference of the views with their names.
 

Cableguy

Expert
Licensed User
Longtime User
you can get the actual ( as the name NOW) reference of a view

just do a LOG(MyViewName)
 
Top