Hi there!
I would need to build a function that will return me a view, contained in a panel, knowing only the name of the view (no ID, no tags) ...
The panel is populated by a call to other loadlayout and later in a sub I can call asynchronously use the method call GetView, passing the index of the view that I intend to use.
But since the designer I insert my view by specifying the name, I also want to take just using their name!
I tried building a function in java like this:
but the Id returned is always 0 (probably because the id is not mapped in the R class)
how could I do? how do you do it?
you could post a snippet that works?
Thanks to all in advance for any response.
I would need to build a function that will return me a view, contained in a panel, knowing only the name of the view (no ID, no tags) ...
The panel is populated by a call to other loadlayout and later in a sub I can call asynchronously use the method call GetView, passing the index of the view that I intend to use.
But since the designer I insert my view by specifying the name, I also want to take just using their name!
I tried building a function in java like this:
B4X:
int Id = pBA.context.getResources().getIdentifier(Name, "id", pBA.context.getPackageName());
Log.d("B4A", "GetViewByName - Id = " + Id);
View V = container.getObject().findViewById(Id);
Log.d("B4A", "GetViewByName - V = " + V);
return V;
but the Id returned is always 0 (probably because the id is not mapped in the R class)
how could I do? how do you do it?
you could post a snippet that works?
Thanks to all in advance for any response.