Take the 2-minute tour ×  I have this array of jvalue type and I
want to assign string values.  I'm on unity trying to pass
parameters to my Java function using JNI library    jvalue[]
myArray = new jvalue[2];         gui.text=
AndroidJNI.CallStaticStringMethod(obj_Activity, startAdsMethod,
myArray);  How to achieve the code above?  I'm getting the error
whilst assigning values to the array because the array is not of
string type my function takes string parameters and jni wants
them in form of array.  share|improve this question
StackOverflow is not a Mind Reader –  EJP Jun 6 '12 at 9:51 add
comment  1 Answer  The following code creates an array and
assigns a few strings to use in any following JNI calls:  var
arguments = new object[2]; foreach( var entry in variables ) {
using( var key = new AndroidJavaObject( "java.lang.String",
entry.Key ) ){         using( var val = new AndroidJavaObject(
"java.lang.String", entry.Value ) ){             arguments[0] =
key;             arguments[1] = val;