I have made a Library with the Ndk and a Wrapper. The wrapper works with Eclipse, how can I use it at B4A?
Wrapper:
Class:
Eclipse-Example:
Wrapper:
B4X:
#include <jni.h>
#include "./library/test.h"
extern "C" {
JNIEXPORT jboolean JNICALL Java_de_wal_librarytest_MBJniClass_OpenPort(JNIEnv * env, jobject obj, jboolean usebool);
JNIEXPORT jboolean JNICALL Java_de_wal_librarytest_MBJniClass_ClosePort(JNIEnv * env, jobject obj);
};
JNIEXPORT jboolean JNICALL Java_de_wal_librarytest_MBJniClass_OpenPort(JNIEnv * env, jobject obj, jboolean usebool)
{
return OpenPort(usebool);
}
JNIEXPORT jboolean JNICALL Java_de_wal_librarytest_MBJniClass_ClosePort(JNIEnv * env, jobject obj)
{
return ClosePort();
}
Class:
B4X:
package de.wal.librarytest;
public class MBJniClass {
static {
System.loadLibrary("testlibrary");
}
public static native boolean OpenPort(boolean usebool);
public static native boolean ClosePort();
}
Eclipse-Example:
B4X:
package de.wal.librarytest;
import de.wal.librarytest.MBJniClass;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (MBJniClass.OpenPort(true)) {
int i = 1
}
}