Re: Capturing the return values of a 2d array
Posted By:
Daniel_Ray
Posted On:
Friday, October 26, 2001 12:48 PM
This is one solution I've found
Assumes that you've already obtained the method ID
Because method is not static, we pass an instance of the class
jobject jobj instead of the jclass cls
jobjectArray jray = (jobjectArray)penv->CallObjectMethod(jobj, MID);
jsize firstSize = penv->GetArrayLength(jray);
for(int i=0; i
{
jobjectArray firstDimension = (jobjectArray)penv->GetObjectArrayElement(jray, i);
jsize secondSize = penv->GetArrayLength(firstDimension);
for(int j=0; j
{
jstring jstr = (jstring)penv->GetObjectArrayElement(firstDimension, j);
const char *temp = penv->GetStringUTFChars(jstr, 0);
// Print out value of temp (C++ Builder)
JNITestFormRichEdit->Lines->Add(temp);
// Free the memory
penv->ReleaseStringUTFChars(jstr, temp);
}
}