src/core/android/SDL_android.cpp
changeset 7083 0cb47cc139d3
parent 7045 4be2c24b7de1
child 7095 79ca4d26d4b3
equal deleted inserted replaced
7082:e9d6004d2978 7083:0cb47cc139d3
  1128 extern "C" void *SDL_AndroidGetJNIEnv()
  1128 extern "C" void *SDL_AndroidGetJNIEnv()
  1129 {
  1129 {
  1130     return Android_JNI_GetEnv();
  1130     return Android_JNI_GetEnv();
  1131 }
  1131 }
  1132 
  1132 
       
  1133 /*
       
  1134  * The jobject returned by SDL_AndroidGetActivity is a local reference.
       
  1135  * It is the caller's responsibility to properly release it
       
  1136  * (using LocalReferenceHolder or manually with env->DeleteLocalRef)
       
  1137  */
       
  1138 
  1133 extern "C" void *SDL_AndroidGetActivity()
  1139 extern "C" void *SDL_AndroidGetActivity()
  1134 {
  1140 {
  1135     LocalReferenceHolder refs(__FUNCTION__);
       
  1136     jmethodID mid;
  1141     jmethodID mid;
  1137 
  1142 
  1138     JNIEnv *env = Android_JNI_GetEnv();
  1143     JNIEnv *env = Android_JNI_GetEnv();
  1139     if (!refs.init(env)) {
  1144     if (!env) {
  1140         return NULL;
  1145         return NULL;
  1141     }
  1146     }
  1142 
  1147 
  1143     // return SDLActivity.getContext();
  1148     // return SDLActivity.getContext();
  1144     mid = env->GetStaticMethodID(mActivityClass,
  1149     mid = env->GetStaticMethodID(mActivityClass,