In Android can one use/implement a listener that fires a callback when the number of children for a given View changes dynamically? Say for example a View has 3 immediate children, and one is removed through code, I need an event to fire to say that the number of immediate children has changed.
To clarify, I don’t need to perform a depth traversal on the View tree to count children, I’m just interested in counting the number of children at the first layer of a given View.
Many thanks
I believe that you want to use the OnHierarchyChangeListener:
It has two callbacks: