Can I know the name of the class that calls a JNI C method?(我能知道调用 JNI C 方法的类的名称吗?)
问题描述
Is there any way I can know the name of the class that called a method in JNI C code ? I can obtain a reference to the class using the following statement :
But is there any way I can know the name of the class ? .
This code will give you the calling class name:
Note that I haven't taken any actions to check for errors. This is just a small code snippet describing how it could be done.
Alternatively you could do this instead of using the GetStringUTFChars/ReleaseStringUTFChars
:
No need to release since the string is copied to local buffer.
这篇关于我能知道调用 JNI C 方法的类的名称吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!