Skip to content

Instantly share code, notes, and snippets.

@Gowiem
Created August 17, 2013 19:09
Show Gist options
  • Save Gowiem/6258313 to your computer and use it in GitHub Desktop.
Save Gowiem/6258313 to your computer and use it in GitHub Desktop.
// The following method only returns the public static variables of the View class
// when called like so:
// Class klass = android.view.View.class;
// parser.getAllFieldsForClass(klass);
public Field[] getAllFieldsForClass(Class klass) {
Field[] fields = klass.getDeclaredFields();
if (fields.length == 0) {
return new Field[0];
} else {
return fields;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment