Manipulating arrays in JNI
JNI exposes strings, classes, instance objects, and arrays as reference types. This recipe will discuss arrays in JNI.
Getting ready
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 ascookbook.chapter2
. Create an activity namedArrayManipulationActivity
. Under the project, create a folder namedjni
. Refer to the Loading native libraries and registering native methods recipe of this chapter for more detailed instructions. - Create a file named
arraytest.c ...
Get Android Native Development Kit Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.