Android Question Finding the type and name of a views parent

AKJammer

Active Member
Licensed User
Hey,

Is there a way to find the type and name of a views parent? I'm using a couple CustomListViews in several tabs along with CLVSelections. When a user hits a button I can get the button info from Sender, but I'd like to be able to walk up and down the parent tree to find who hit it on which panel. Is there some straightforward way of doing this, probably using the .parent method?

Thanks,
Jim
 

josejad

Expert
Licensed User
Longtime User
Hi:

Maybe you can make some test with this code
B4X:
For Each v As View In Activity.GetAllViewsRecursive
   If v Is CheckBox Then  '<----- change Checkbox for the type of view you need
       SetButtonTintList(v, Colors.Red, Colors.Blue)
   End If
Next
from this thread

You can change the Activity.GetAllViewsRecursive for the parent of your views.
I.e, if you have your views in a panel you can check with panel.GetAllViewsRecursive or if you have a button inside a panel, button.parent.GetAllViewsRecursive
 
Upvote 0

AKJammer

Active Member
Licensed User
Thanks, the "if v is checkbox" part is what I should be able to use. Then just have to pull the name of it.
 
Upvote 0
Top