logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

al_android_get_jni_env - Allegro 5 API

Description

       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.

       For example if you have a Java method “void send(String message)” in your activity class, you could  call
       it like this from C code:

              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, "send",
                  "(Ljava/lang/String;)V");
              jstring jdata = (* env)->NewStringUTF(env, "Hello Java!");
              (* env)->CallVoidMethod(env, al_android_get_activity(), method_id, jdata);
              (* env)->DeleteLocalRef(env, jdata);

Name

       al_android_get_jni_env - Allegro 5 API

Since

       5.2.2

              [UnstableAPI]: This API is new and subject to refinement.

Allegro reference manual                                                         al_android_get_jni_env(3alleg5)

Synopsis

              #include <allegro5/allegro_android.h>

              JNIEnv *al_android_get_jni_env(void)

See Also