Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 544
swinefeaster Avatar asked Feb 02 '11 08:02

swinefeaster


1 Answers

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.

like image 168
Harry Joy Avatar answered Oct 07 '22 05:10

Harry Joy