.\" Automatically generated by Pandoc 3.1.3 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. .ie "\f[CB]x\f[]"x" \{\ . ftr V B . ftr VI BI . ftr VB B . ftr VBI BI .\} .el \{\ . ftr V CR . ftr VI CI . ftr VB CB . ftr VBI CBI .\} .TH "al_android_get_jni_env" "3alleg5" "" "Allegro reference manual" "" .hy .SH NAME .PP al_android_get_jni_env - Allegro 5 API .SH SYNOPSIS .IP .nf \f[C] #include JNIEnv *al_android_get_jni_env(void) \f[R] .fi .SH DESCRIPTION .PP Returns the Android JNI environment used by Allegro to call into Java. As a convenience this function provides it to the user so there is no need to obtain it yourself. .PP For example if you have a Java method \[lq]void send(String message)\[rq] in your activity class, you could call it like this from C code: .IP .nf \f[C] JNIEnv * env = al_android_get_jni_env(); jclass class_id = (* env)->GetObjectClass(env, al_android_get_activity()); jmethodID method_id = (* env)->GetMethodID(env, class_id, \[dq]send\[dq], \[dq](Ljava/lang/String;)V\[dq]); jstring jdata = (* env)->NewStringUTF(env, \[dq]Hello Java!\[dq]); (* env)->CallVoidMethod(env, al_android_get_activity(), method_id, jdata); (* env)->DeleteLocalRef(env, jdata); \f[R] .fi .SH SINCE .PP 5.2.2 .RS .PP \f[I][Unstable API]:\f[R] This API is new and subject to refinement. .RE