Calling Java Objects in C++ in Android NDK - What IDE to use? -
i need use c++ code in android app, i'm doing using ndk/jni. have able use java objects in c++. (note: not using c++ methods in java.)
my problem ide. have c++ code in folder called 'jni' in android project. have installed cdt in eclipse. helloworld c++ project works fine confirming cdt set fine.
what not know how run c++ code?
thanks in advance!
you going need native method in class signature such as
native void processdata(byte[] data);
then in jni code need c function correct name
extern "c" jniexport void jnicall java_your_package_and_class_processdata(jnienv* env, jobject clazz, jobject data);
the javah tool can right names match java class. in native code , have reference class instance , byte array. can access data in byte array using jni methods provided through jnienv
instance. android jni tips page has on this, should read rest of page if new jni.
i have assumed modifying data in byte array if need return in new byte array check out functions available in jnienv
. note: when using c++ not pass jnienv*
first parameter instead call functions env->...
this not problem ide if project not setup build ndk code not built. believe eclipse has tools adding ndk build features.
Comments
Post a Comment