swinefeaster swinefeaster -4 years ago 157
Android Question

Enumerate/Iterate all Views in Activity?

Is there a way to iterate through all the views in your Activity? Something like:

Iterator it = getViewIterator();

Does this exist at all?

Answer Source

If you have all your Views in a LinearLayout or an other container that extends ViewGroup you can use the functions getChildCount() and getChildAt(int) and iterate through all of the
contained views.

Hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download