2

How can I get all classes within a namespace in android? I found some links for java but they do not work for android.

Edit:

I want to iterate on classes which I defined in a package. these classes have a static field that I want to get its value. I get that field using reflection but I can not loop on my defined classes.

How can I loop on my classes?

Thanks,

jbowes
  • 4,062
  • 22
  • 38
Bob
  • 22,810
  • 38
  • 143
  • 225

1 Answers1

0

Sounds like you are looking for Reflection. Reflection allows you to inspect yourself programmatically and determine characteristics, like whether you implement an interface or a method by a particular name.

http://docs.oracle.com/javase/tutorial/reflect/

http://java.sun.com/developer/technicalArticles/ALT/Reflection/

knaak
  • 1,293
  • 1
  • 12
  • 18
  • I din not find anything about namespace in these links. It is only about classes. – Bob Feb 22 '12 at 13:26
  • 1
    If you want to scan packages, you can try this: http://code.google.com/p/reflections/ but I didn't review it enough to know if it would fit your needs. see this: http://stackoverflow.com/questions/520328/can-you-find-all-classes-in-a-package-using-reflection – knaak Feb 22 '12 at 13:42