While there is documentation regarding turning a jstring
to a native string (string nativeString = env->GetStringUTFChars(jStringVariable, NULL);
) I can't find an example which will convert a jboolean
to a bool
or a jint
to an int
.
Can anyone suggest how this is achieved?
You just need to cast jint
to int
using C style casts. Same for jboolean
to bool
(if you're using C99 bool
type) or to uint8_t
(if you're using std int types) or to unsigned char
.
Open $NDK_ROOT/platforms/android-8/arch-arm/usr/include/jni.h
and you'll see jint
, jboolean
etc are just typedef
s.