Java:
public native boolean setData(int type, String[] data);
JNI:
static jboolean jni_set_data(JNIEnv *env, jobject thiz, jint jtype, jobjectArray jarray)
{
jsize strArrayLen = (*env)->GetArrayLength(env, jstringArray);
const char ** addresses = malloc(sizeof(char *) * strArrayLen);
if (!addresses || !(*addresses)) return JNI_FALSE;
for (int i = 0; i < strArrayLen; ++i)
{
jstring jip = (*env)->GetObjectArrayElement(env, jstringArray, i);
const char* ip = (*env)->GetStringUTFChars(env, jip, NULL);
//do something here
(*env)->ReleaseStringUTFChars(env, jip, ip);
}
(*env)->DeleteLocalRef(env, jarray);
reture JNI_TRUE;
}
//--------
{"setData", "(I[Ljava/lang/String;)Z", (void*) jni_set_data}