We know from a previous part that a string is represented in JNI as a
, which is in fact a Java object which means that it is possible to exchange Java objects through JNI! But because native code cannot understand or access Java directly, all Java objects have the same representation: a
In this part, we are going to focus on how to save an object on the native side and how to send it back to Java. In the next project, we are going to work with colors, although any other type of object would work.
Project Store_Part3-1 can be used as a starting point for this part. The resulting project is provided with this book under the name Store_Part3-2.