问题描述
我有一个Java函数,可以接受可变数量的参数,在JNI中,我在jobjectArray中接收所有参数.但是问题是String类型中可用的所有参数,但最初您的数据类型不同.因此,在c/c ++中无法将它们转换为原始类型.因此,如果我可以调用其他Java方法来简化这些转换,是否有可能从JNI的本机代码中调用Java方法?
I have a Java function which can take variable number of parameters and in JNI I am receiving all the parameters in jobjectArray. But the problem is all the parameters available in String type,but originally thy are of different datatype. So in c/c++ converting them to their original type is not possible. So if i could call some other java method which will make these conversions easy for me.is it possible in to call a java method from native code in JNI?
请帮帮我.很长时间以来,我的确为之震惊.预先感谢.
Please help me out. I am really struck at it from a long time. Thanks in advance.
推荐答案
当您使用env-> NewStringUTF(实际参数)回调java方法时,我们可以将String作为来自本地代码的参数传递.
we can pass the String as a parameter from native code when you callback the java method using env->NewStringUTF(actual parameter).
这篇关于我可以从本地代码调用Java方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!