I have to return an
java object(IPDetails) from a java method using JNI.
I am using the following code for this.But the NULL value is getting.
Why this is becoming NULL.Is this the correct way of returning an Object
from a java function?
jobject ipDetails;
ipDetails = (*env)->CallObjectMethod(env,jobj,methodID,(*env)->NewStringUTF(env,userName));
The IPDetails class has 2 fields
a
String field (ip) and a boolean field (accept)
.I want the 2 field values to be retrieved from the object
returned from the java method and be used in the C program.
For that,
jclass detailsClass = (*env)->FindClass(env,"com/test/IPDetails");
jfieldId ipID = (*env)->GetFieldID(env,detailsClass,"ip","Ljava/lang/String;");
jboolean acceptID = (*env)->GetFieldID(env,detailsClass,"accept","Z");
For getting the ip and accept fields of the ipDetails object which function
shall i use??
Can anyone suggest how can i call and get the above two fields
of the object returned.
Thanks