On Jul 15, 11:56 am, philip hays <blackspyder31...@gmail.com> wrote: > jbyte* imageData_out = (*env)->NewByteArray(env, length);
NewByteArray returns a jbyteArray, not a pointer to jbyte. > (*env)->GetByteArrayRegion(env, imageData_in, 0, length, > (jbyte*)imageData_out); This copied the data onto the start of the array object, trampling imageData_out's object header, probably leading to the crash. The array length is stored in that header, which is why the length value appears to jump. If you want to copy imageData_in to imageData_out, you need to use GetByteArrayElements on imageData_out to get the jbyte*, do the GetByteArrayRegion into that, and then ReleaseByteArrayElements when you're done. Another poster also pointed out that you should be checking the length of imageData_in to make sure you don't overflow. FWIW, you're probably better off asking JNI questions on android-ndk. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en