src/android/source/iupandroid_common.c
jobject iupAndroid_GetCurrentActivity(JNIEnv* jni_env)
{
	IUPJNI_DECLARE_METHOD_ID_STATIC(IupApplication_getCurrentActivity);
	jclass java_class;
    jmethodID method_id;
	jobject ret_object = NULL;

	jobject application_object = iupAndroid_GetApplication(jni_env);

	// We actually know the class has to be IupApplication, which is already cached in s_classIupApplication
//    java_class = (*jni_env)->GetObjectClass(jni_env, application_object);
	java_class = (*jni_env)->NewLocalRef(jni_env, s_classIupApplication);
	method_id = IUPJNI_GetMethodID(IupApplication_getCurrentActivity, jni_env, java_class, "getCurrentActivity", "()Landroid/app/Activity;");
	ret_object = (*jni_env)->CallObjectMethod(jni_env, application_object, method_id);

	(*jni_env)->DeleteLocalRef(jni_env, java_class);
	(*jni_env)->DeleteLocalRef(jni_env, application_object);

	return ret_object;
}
// Note: Because the "Current" activity can change, we don't want to cache it.
Because the "Current" activity can change, we don't want to cache it.
Because the " Current " activity can change we don ' t want to cache it .
jobject iupAndroid_GetCurrentActivity(JNIEnv* jni_env)
{
	IUPJNI_DECLARE_METHOD_ID_STATIC(IupApplication_getCurrentActivity);
	jclass java_class;
    jmethodID method_id;
	jobject ret_object = NULL;
	jobject application_object = iupAndroid_GetApplication(jni_env);
	java_class = (*jni_env)->NewLocalRef(jni_env, s_classIupApplication);
	method_id = IUPJNI_GetMethodID(IupApplication_getCurrentActivity, jni_env, java_class, "getCurrentActivity", "()Landroid/app/Activity;");
	ret_object = (*jni_env)->CallObjectMethod(jni_env, application_object, method_id);
	(*jni_env)->DeleteLocalRef(jni_env, java_class);
	(*jni_env)->DeleteLocalRef(jni_env, application_object);
	return ret_object;
}
jobject iupAndroid_GetCurrentActivity ( JNIEnv * jni_env ) { IUPJNI_DECLARE_METHOD_ID_STATIC ( IupApplication_getCurrentActivity ) ; jclass java_class ; jmethodID method_id ; jobject ret_object = NULL ; jobject application_object = iupAndroid_GetApplication ( jni_env ) ; java_class = ( * jni_env ) -> NewLocalRef ( jni_env , s_classIupApplication ) ; method_id = IUPJNI_GetMethodID ( IupApplication_getCurrentActivity , jni_env , java_class , " " , " " ) ; ret_object = ( * jni_env ) -> CallObjectMethod ( jni_env , application_object , method_id ) ; ( * jni_env ) -> DeleteLocalRef ( jni_env , java_class ) ; ( * jni_env ) -> DeleteLocalRef ( jni_env , application_object ) ; return ret_object ; }
Note: Because the "Current" activity can change, we don't want to cache it.
Note : Because the " Current " activity can change we don ' t want to cache it .
// We actually know the class has to be IupApplication, which is already cached in s_classIupApplication //    java_class = (*jni_env)->GetObjectClass(jni_env, application_object);