how to return enum from JNI

后端 未结 2 825
无人及你
无人及你 2020-12-05 14:47

In java I have:

public class MyClass{

    public enum STATUS {
        ZERO,
        ONE ,
        TWO
    }

    public native STATUS nativeGetStatus();

          


        
2条回答
  •  醉话见心
    2020-12-05 15:33

    Of course, you can do it. Enum values are public static fields of Enum class, so you can use this official manual to write the code. Just get the field from JNI and return it as jobject.

提交回复
热议问题