Android Question GetView by name

LucaMs

Expert
Licensed User
Longtime User
This is something which I have always felt the lack.

While searching here on the site if there was at least a way to match the indexes (badly explained but now it does not matter) I found this thread/Library:
XmlLayoutBuilder - Load Xml layouts

In the example, there is:
B4X:
Dim x As XmlLayoutBuilder
' ...
Panel1 = x.GetView("panel1")

In addition, Periklis Koutsogiannis has found a way to solve this problem.

How we can do it?
 

ilan

Expert
Licensed User
Longtime User
At least you could use a map in this way:

mapTag.Put("ViewName", ObjOfYourType)

i am not sure if i understand you well or you didnot understood what is my problem.

the thing is that i create my views in DESIGNER and i want to use the same EVENT (SUB) for several views so to to know what view was clicked with the sender method i could use the tag property but i NEED it for a dynamic TYPE object that will change in code. so this is not an option.

if i could get the view NAME i could use it to know what view was pressed.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Could you use your code and create maps at runtime and add after them to the tags?

no

i have a list with lots of items and when i click on it a panel will open with about 10 views then i will fill all view tags with a custom TYPE object from the item that was clicked and use all those tag properties when i save the item again so the tag will always change and it will need to hold the custom TYPE object when i click on it.
if i will set the tag to something different i will loose the custom type object.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
ok never mind i will use a Global object that will hold all those custom types instead of using the tag of the view.

thanks and sorry for waking up this old thread :)

ps: if someone will find the solution how to load the view name property please post the code in this thread.

thank you
 
Upvote 0
Top