Manipulating classes in JNI

The previous recipe discusses that Android JNI supports three different kinds of references. The references are used to access the reference data types, including string, class, instance object, and array. This recipe focuses on class manipulations in Android JNI.

Getting ready

The Managing References in NDK recipe should be read first before going through this recipe.

How to do it…

The following steps describe how to build a sample Android application that illustrates class manipulation in JNI:

  1. Create a project named ClassManipulation. Set the package name as cookbook.chapter2. Create an activity named ClassManipulationActivity. Under the project, create a folder named jni. Refer to the Loading native libraries and registering ...

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.