This example shows how to use nmtools from android.
Using android studio:
- open projects
- build
You need to install android ndk to build the example.
- use javac to generate JNI header:
This will generate
cd examples/android/nmtoolsdemo/app/src/main/java/com/example/nmtools_demo openjdk.javac -h . NmTools.java
.class
files - use javap to check java signature to use java class from JNI:
example result:
cd examples/android/nmtoolsdemo/app/src/main/java/com/example/nmtools_demo /snap/openjdk/1241/jdk/bin/javap -s NmTools\$NDArrayFloat.class
Compiled from "NmTools.java" public class com.example.nmtools_demo.NmTools$NDArrayFloat { public com.example.nmtools_demo.NmTools$NDArrayFloat(); descriptor: ()V public com.example.nmtools_demo.NmTools$NDArrayFloat(float[], int[]); descriptor: ([F[I)V public java.lang.String to_string(); descriptor: ()Ljava/lang/String; public float[] get_data(); descriptor: ()[F public int[] get_shape(); descriptor: ()[I }