android iterate through objects on xml and find the type
Is there a way to iterate through the objects on a form and find all the types. In VBNet you would do something like:
For each control on form
print typename(control)
What I mean by a form is the UI that the user can see, I guess that is the Context? If I have an XML that say has 2 buttons and a textview, is there a way from the java code to see what all of the object are that has been loaded from the XML.
I am trying to make a generic class that I can use on all UI classes that will look through every object and if its a button then change the colors on that button.
Alternately I could do this manually for every UI an开发者_JS百科d object.
a normal "java for" :
for( Control c : ArrayList<Control> controlList){
System.out.println(c.getTypeName();
}
hope it helps.
精彩评论