Core implementation of
app.nit on Android using a custom Java entry point
This module is implemented in 3 languages:
The Java code, in
NitActivity.javaacts as the entry point registered to the Android OS. It relays most of the Android callbacks to C. In theory, there may be more than one instance of
NitActivityalive at a given time. They hold a reference to the corresponding Nit
Activityin the attribute
The C code is defined in the top part of this source file. It acts as a glue between Java and Nit by relaying calls between both languages. It keeps a global variables reference to the Java VM and the Nit
The Nit code defines the
Activityclass with the callbacks from Android. The callback methods should be redefined by user modules.
The main is invoked when the native library is dynamically linked by the Java virtual machine. For this reason, the main must execute quickly, on the main UI thread at least.