Calling Java with params


#1

I am using the DECLARE_JNI_CLASS and JNI_CLASS_MEMBERS macros to pass parameters to Java functions from C++ (native) world. That works for strings (thank you vipersnake) but I don't see where to find info about other parameter types (what the #*%@! do these "([SII)I" (btw is there a typo there?) or "(IIIII)V" or "(F)V" etc. mean and where are they defined ???

Any clue ? Thanx !


#2

Not exactly easy or straightforward however once you get the hang of it it starts to make sense (a little).  Here is a link to a great site that has more info on it in an easy to read way.

 

http://journals.ecs.soton.ac.uk/java/tutorial/native1.1/implementing/index.html

 

The part you really want is the "Calling Java Methods"

 

In your example up above "(IIIII)V" means the function takes 5 'ints' and returns Void. 

 

Your are definitely into some more complex coding when doing this and a possible easy way to learn may be to look at other functions that Jules already defined and use something that is close. And other times maybe you can take a shortcut. So rather than trying to pass a Bitmap up to Java save it to the application directory and pass the string? Not the most ideal way of doing it but it may at least get you to point B without having to pass through C, D, E, and F along the way.


#3

Ah ! I didn't realize they were part of the JNI specs. Thanks again for taking me to the right direction...