Chapter 4. Calling Java Back from Native Code
To reach its full potential, JNI allows calling back Java code from C/C++. "Back" because native code is first invoked from Java, which in turn calls it back. Such calls are performed through a reflective API, which allows doing almost anything that can be done directly in Java.
Another important matter to consider with JNI is threading. Native code can be run on a Java thread, managed by the Dalvik VM, and also from a native thread created with standard POSIX primitives. Obviously, a native thread cannot call JNI code unless it is turned into a managed Java thread! Programming with JNI necessitates knowledge of all these subtleties. This chapter will guide you through the main ones.
The last topic, which is specific to Android and not JNI, other: the Android-specific Bitmap API aims at giving full processing power to graphics applications running on these tiny (but powerful) devices.
The Android NDK also proposes a new...