java - How to iterate through nested classes? -
another simple one!
i'm trying iterate through nested classes in android project.
the class structure is:
public class clsmessage { public string username = ""; public string password = ""; public string request = ""; public class parameters { public string name = ""; public string value = ""; } }
the outer class instantiated "msg". thought i'd query this:
(clsmessage.parameters params : msg) { // stuff }
but doesn't work , can't find example on google surprisingly, unless should using iterator in outer class?
i guessing looking following.
public class clsmessage { public string username = ""; public string password = ""; public string request = ""; public list<parameters> parameters = new arraylist<parameters>(); public static class parameters { public string name = ""; public string value = ""; } } for(clsmessage.parameters param : clsmessage.parameters) { .... }
just declaring inner class won't have "inner class" field. need make field it. considering wanted iterate through for-loop, assumed wanted more 1 parameters
in message, added list
.
Comments
Post a Comment