Android Utililty Methods Field Set

List of utility methods to do Field Set

Description

The list of methods to do Field Set are organized into topic(s).

Method

voidsetFieldValue(Object obj, String name, Object value)
set Field Value
Field field;
try {
    field = obj.getClass().getDeclaredField(name);
    field.setAccessible(true);
    field.set(obj, value);
} catch (NoSuchFieldException e) {
    e.printStackTrace();
} catch (IllegalArgumentException e) {
...
voidsetFieldValue(Object obj, String propertyName, Object value)
set Field Value
try {
    Field field = obj.getClass().getDeclaredField(propertyName);
    field.setAccessible(true);
    field.set(obj, value);
} catch (Exception ex) {
    throw new RuntimeException();