Manipulating arrays in JNI
JNI exposes strings, classes, instance objects, and arrays as reference types. This recipe will discuss arrays in JNI.
You should make sure you've read the following recipes before going through this recipe:
- Managing references in JNI
- Manipulating classes in JNI
How to do it…
In this section, we will create a sample Android project that demonstrates how to manipulate arrays in JNI.
- Create a project named
ArrayManipulation. Set the package name as
cookbook.chapter2. Create an activity named
ArrayManipulationActivity. Under the project, create a folder named
jni. Refer to the Loading native libraries and registering native methods recipe of this chapter for more detailed instructions.
- Create a file named