Return to Snippet

Revision: 45047
at April 22, 2011 19:43 by jwielandt

Initial Code
NIEXPORT jobject JNICALL Java_be_arrowup_argenta_CardReader_readCardMaestroNative(JNIEnv *env, jobject obj)
		jclass cls = NULL;
		jobject jData = jniCreateObject (env, "Data", cls);
		if (jCardData == NULL || cls == NULL) {
			return NULL;
                size_t byteArrayLength = 10;

		//set the iso2 byte data
		jbyteArray jByteArray =  env->NewByteArray(byteArrayLength);
		env->SetByteArrayRegion(isoByteArray, 0, byteArrayLength, (jbyte*)nativeByteArray);

		jfieldID byteArrayId = env->GetFieldID(cls, "bArrayName", "[B");

		env->SetObjectField(Data, byteArrayId, jByteArray);


Initial URL

Initial Description

Initial Title
jni init array from object

Initial Tags
java, c++

Initial Language