JNIEXPORT jintArray JNICALL java_com_example_feisou_a02_1helloworld_JNI_arrElementsIncrease (JNIEnv *env, jobject thiz, jintArray jarray){ jsize length = (*env)->GetArrayLength(env,jarray); LOGD("length = %d",length); //jboolean iscopy; jint* arrayPointer = (*env)->GetIntArrayElements(env,jarray,NULL); int i; for(i=0;i<length;i++){ *(arrayPointer+i) += 10; } (*env)->SetIntArrayRegion(env, jarray, 0,length,arrayPointer); return jarray;}
public void click2(View V){ int[] array = new int[]{1,2,3,4,5}; for(int i: jni.arrElementsIncrease(array)){ Log.d("test",i+""); } }
新闻热点
疑难解答