Re-organized activity_edit_text

(Old Android versions throw an exception if you try to set a field marked as final using reflection.)
pull/3/head
Olga Miller 2017-03-11 16:11:21 +01:00
rodzic ea1eb2775e
commit d889bb574c
1 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -19,6 +19,7 @@ import android.graphics.Color;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
public class Label implements Serializable {
public static final float TEXT_SIZE_NORMAL = 2f;
@ -128,7 +129,8 @@ public class Label implements Serializable {
Label clone = new Label();
try {
for (Field field : getClass().getDeclaredFields()) {
field.set(clone, field.get(this));
if (!Modifier.isFinal(field.getModifiers()))
field.set(clone, field.get(this));
}
} catch (Exception ignore) {
}