Hi, I want to use a type as an enum and I don't want to set the value of each string of that type since the fieldname IS what the string value will be. How to do it with Reflector or JavaObject ?
java.lang.NoSuchFieldException: Desert
at java.lang.Class.getDeclaredField(Class.java:2070)
OR : do you suggest another approach entirely. Thanks !
B4X:
Dim r As Reflector
r.Target = BiomeType
r.Target = r.RunMethod("getClass")
Dim Fields() As Object = r.RunMethod("getDeclaredFields")
For Each Field As Object In Fields
r.Target = Field
Dim name As String = r.RunMethod("getName")
If name = "IsInitialized" Then Continue
r.SetField(name,name, "java.lang.string") <--- error
Next
Next
java.lang.NoSuchFieldException: Desert
at java.lang.Class.getDeclaredField(Class.java:2070)
OR : do you suggest another approach entirely. Thanks !