• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

return object with stringArray as its content from JNI

Hi,

i have a class something like,

public class temp {
    int x;
    String str;
    String[] strArray;
}

now i want to return this object completely from JNI. So, return object should have int,string and stringArray.
how can i do this ?
code sample will be highly appreciated.

thanks,
Hitesh
0
hitu_shah
Asked:
hitu_shah
  • 3
  • 2
1 Solution
 
CEHJCommented:
Write a method that returns a type of 'temp'. You need to set create it and set its fields with SetIntField and SetObjectField. There's an example here:

http://java.sun.com/docs/books/jni/html/fldmeth.html
0
 
hitu_shahAuthor Commented:
Hi CEHJ,

if you give me some type of example for the above class it will be great.
I read the link you sent me but it doesn't mention how can i fill array of string.

thanks in advance,
Hitesh
0
 
CEHJCommented:
There are some examples with arrays here:

http://java.sun.com/docs/books/jni/html/objtypes.html
0
 
hitu_shahAuthor Commented:
Hi CEHJ,

i have seen this example. But it returns object array. What i am saying is that i can fill the array of string from JNI, but how can i assign this filled object to the strArray[] parameter in above class.

again, if you give some sample code it will be excellent.

thanks,
Hitesh
0
 
CEHJCommented:
Unfortunately not much time now as i have to go out

>>but how can i assign this filled object to the strArray[] parameter in above class.

You need to call SetObjectField on it
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now