src/core/android/SDL_android.cpp
changeset 6392 fa7eb111f994
parent 6377 3d868ca4782f
child 6448 64a6297a8b93
     1.1 --- a/src/core/android/SDL_android.cpp	Thu Aug 09 15:43:39 2012 -0400
     1.2 +++ b/src/core/android/SDL_android.cpp	Sat Aug 11 10:15:59 2012 -0700
     1.3 @@ -735,6 +735,21 @@
     1.4      return Android_JNI_FileClose(ctx, true);
     1.5  }
     1.6  
     1.7 +// sends message to be handled on the UI event dispatch thread
     1.8 +extern "C" int Android_JNI_SendMessage(int command, int param)
     1.9 +{
    1.10 +    JNIEnv *env = Android_JNI_GetEnv();
    1.11 +    if (!env) {
    1.12 +        return -1;
    1.13 +    }
    1.14 +    jmethodID mid = env->GetStaticMethodID(mActivityClass, "sendMessage", "(II)V");
    1.15 +    if (!mid) {
    1.16 +        return -1;
    1.17 +    }
    1.18 +    env->CallStaticVoidMethod(mActivityClass, mid, command, param);
    1.19 +    return 0;
    1.20 +}
    1.21 +
    1.22  #endif /* __ANDROID__ */
    1.23  
    1.24  /* vi: set ts=4 sw=4 expandtab: */