Skip to content

Instantly share code, notes, and snippets.

@MaximAlien
Last active October 21, 2015 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaximAlien/55929e6bcad83bf1f98e to your computer and use it in GitHub Desktop.
Save MaximAlien/55929e6bcad83bf1f98e to your computer and use it in GitHub Desktop.
[Android] [JNI] Assign value of the int array through JNI
int[] intVal = new int[1];
JNIEXPORT jboolean JNICALL Java_com_test_example_ChIntVal_change_int(JNIEnv* env, jobject cls, jintArray intValArray)
{
int testVal = -1;
jint *exTypeVal = env->GetIntArrayElements(intValArray, 0);
exTypeVal[0] = testVal;
env->ReleaseIntArrayElements(intValArray, exTypeVal, 0);
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment