Let's see the JNI section today.
The static system.loadlibrary ("String") in the main activity;
This is to load the library you are loading, possibly a file or a namespace, and so on.
Public native functionname (); This is a function that declares that you need to call in the JNI, only as a declaration without having to define the implementation.
Usually it's just passing some basic types, complex types I don't know how to do it, that's enough.
Most of the passes are shaped or character-shaped variables, which are the things you buy or the simple messages you pass.
Because Java and C are not directly intermodulation, it is also necessary to master the basic types of JNI, which are also simple, almost as long as the basic type before adding a "J" OK
For example Int->jint double->jdouble Boolean->jboolean
These are basic, and there are jobject. This is the parent class of all classes in JNI, similar to the Java object.
Look at the Jni file, the Java layer called the native method, in the Jni file should be the name of the definition, otherwise generated so library of the trouble
For example, the main class of my Java is the mainactivity under the Hbsi.dtd.game package.
Then the Nativite method to be implemented in your JNI will be written
Jniexport void Jnicall java_hbsi_dtd_test_mainactivity_fucntionname (jnienv *, jobject);
If you return to reshape or you want to pass parameters to
Jniexport jint jnicall java_hbsi_dtd_test_mainactivity_fucntionname (jnienv *, jobject,jint AGR);
And so on The first parameter is to pass the jnienv in, jnienv is the current thread, by calling Android::androidruntime::registernativemethods () to register the native implementation of the function pointer.
Generally in the game these things are packaged by the game engine, the bottom of the package to do a good understanding, can add a method to use is enough.
There's a lot more to learn.
Android third-party SDK Learning notes (ii)