tiny6410 part of the hardware (serial, LED, PWM buzzer, ADC, etc.) friendly made a hardware library friendlyarm-hardware.so
If the Android application wants to access the above hardware, it will use Java JNI technology
1. The full name of JNI is: Java Native Interface,java local interface, designed to achieve local interaction with C/s + +, not in Java or easy to use code snippets.
2, the writing of JNI steps
A, Java classes that write methods with native declarations
b, using the Javac command to compile a class implemented in a
C, Javah-jni Java class name generate header file with extension h
D. Implement local methods by using C + +
E, generate a dynamic link library from the local method in D
F, OK
1. Write Java program
Class helloworld{
public native void Displayhelloworld ();
static{
System.loadlibrary ("Hello");
}
public static void Main (string[] args) {
New HelloWorld (). Displayhelloworld ();
}
}
Javac Hello.java
Then Javah command
Javah-jni HelloWorld
Generate. h header file as
/* Do isn't EDIT this file-it is machine generated * *
#include <jni.h>
/* Header for class HelloWorld * *
#ifndef _included_helloworld
#define _included_helloworld
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class:helloworld
* Method:displayhelloworld
* Signature: () V
*/
jniexport void Jnicall Java_helloworld_displayhelloworld
(JNIENV *, jobject);
#ifdef __cplusplus
}
#endif
#endif