Rather than just mindlessly copy and pasting, I decide to understand what I’ve copy and pasted, and I got stuck with R.id.class.getFields()! My initial guess was it would be a static Class variable, but does the id class have such?
R = the R class of R.java
id = the inner id class of R.java
class = ??
getFields() = Class.getFields()
R.javais a class. Auto generated class from theResources.R.idis accessing to a inner class. Thepublic static final class id.R.id.classwill give you a Class object of R.id andgetFieldsmethod will return all thepublicfields inside the classR.id. Take a look to thereflectionmechanism.EDIT: reflection.