2
java:Jni jintArray params error
public int [] native getArray(int [] a);
C:
JNIEXPORT jintArray JNICALL
net_tq5_ArrayTest_getArray(JNIEnv *env, jobject obj, jintArray arr) {
return arr;
}
的java:
int[] a = new int[]{1,2,3,4,5};
int[] b = getArray(a);
for(int i=0; i<a.lenght; i++){
Log.i("ArrayTest: ", "" + b[i]);
}
其結果將是:
ArrayTest: 0
ArrayTest: 0
ArrayTest: 0
...
爲什麼? 幫助!
我的拼寫錯誤對不起,應該是jintArray; – Croplio 2011-01-10 10:56:24