Acessing object's String array member in c++
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Satish_Gauns
Posted On:   Thursday, September 28, 2006 05:43 AM

Hi I am passing a java class object to the c++ method. This class object have one String array member. I am not able to get these array elements in c++. I can access members which are just String type.Accessing String array it is giveing errors. I am not able to code to get the ID of this String array in C++. my code is below.... JNIEXPORT jobject JNICALL Java_Manipulator_jniManipulator (JNIEnv *env, jobject thisobject, jobject obj) { bool operationStatus; int operation; const char *realm; jclass cl = env-&g   More>>


Hi


I am passing a java class object to the c++ method.
This class object have one String array member.


I am not able to get these array elements in c++.


I can access members which are just String type.Accessing String array it is giveing errors.


I am not able to code to get the ID of this String array in C++.


my code is below....



JNIEXPORT jobject JNICALL Java_Manipulator_jniManipulator
(JNIEnv *env, jobject thisobject, jobject obj)


{


bool operationStatus;


int operation;


const char *realm;


jclass cl = env->GetObjectClass(obj);


jfieldID fieldNameID = env->GetFieldID(cl, "m_fieldName", "[Ljava/lang/String;");


jarray array = env->GetArrayField(obj, fieldNameID); //getting error here


jsize size = ennv->GetArrayLength(array);


.


.


.


.



}


also do tell me how to access the elements of the=is array.


Please do help me.


Thanks


Satish

   <<Less
About | Sitemap | Contact