Managing references in JNI
JNI exposes strings, classes, instance objects, and arrays as reference types. The previous recipe introduces the string type. This recipe will cover reference management and the subsequent three recipes will discuss class, object, and arrays respectively.
How to do it…
The following steps create a sample Android project that illustrates reference management in JNI:
- Create a project named
ManagingReference
. Set the package name ascookbook.chapter2
. Create an activity namedManagingReferenceActivity
. Under the project, create a folder namedjni
. Refer to the Loading native libraries and registering native methods recipe in this chapter, if you want more detailed instructions. - Create a file named
referencetest.c
under the ...
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.