Android: changing private static final field using java reflection

后端 未结 1 893
失恋的感觉
失恋的感觉 2021-02-18 19:08

Change private static final field using Java reflection

I followed the instructions in the link above to change a private static final field using java reflection. I hav

1条回答
  •  [愿得一人]
    2021-02-18 19:23

    This works for non-static fields.

    Field field = data.getClass().getDeclaredField("type");
    field.setAccessible(true);
    field.set(data, null);
    

    0 讨论(0)
提交回复
热议问题