Manipulating objects in JNI

The previous recipe shows how we can manipulate classes in Android JNI. This recipe describes how to manipulate instance objects in Android NDK programming.

Getting ready

The following recipes should be read first before going through this recipe:

  • Managing references in JNI
  • Manipulating classes in JNI

How to do it…

Now we'll create an Android project with native methods demonstrating the usage of JNI functions related to instance objects. Perform the following steps:

  1. Create a project named ObjectManipulation. Set the package name as cookbook.chapter2. Create an activity named ObjectManipulationActivity. Under the project, create a folder named jni. Please refer to the Loading native libraries and registering native methods ...

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.