Skip to content

Instantly share code, notes, and snippets.

@tankery
Last active February 12, 2018 07:08
Show Gist options
  • Save tankery/b237a6a99ea3e00db98a5b7e32d9cc68 to your computer and use it in GitHub Desktop.
Save tankery/b237a6a99ea3e00db98a5b7e32d9cc68 to your computer and use it in GitHub Desktop.
Show Android Build fields
for (Field field : Build.class.getFields()) {
try {
if (field.getType().isAssignableFrom(String.class)) {
Timber.d("%16s: %s", field.getName(), field.get(null));
}
} catch (IllegalAccessException e) {
Timber.w(e, "Failed to print %s", field.getName());
}
}
for (Field field : Build.VERSION.class.getFields()) {
try {
if (field.getType().isAssignableFrom(String.class)) {
Timber.d("%16s: %s", field.getName(), field.get(null));
}
} catch (IllegalAccessException e) {
Timber.w(e, "Failed to print %s", field.getName());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment