comparison android/dw.cpp @ 2668:917f2d1f9cae

Android: Implement dw_window_destroy() and try to add a back button to secondary windows that will call windowDestroy() on them when pressed.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 17 Oct 2021 00:34:16 +0000
parents ad6fc7f1a9af
children e3a95940c18f
comparison
equal deleted inserted replaced
2667:2ae70678c845 2668:917f2d1f9cae
5499 * Returns: 5499 * Returns:
5500 * DW_ERROR_NONE (0) on success. 5500 * DW_ERROR_NONE (0) on success.
5501 */ 5501 */
5502 int API dw_window_destroy(HWND handle) 5502 int API dw_window_destroy(HWND handle)
5503 { 5503 {
5504 return DW_ERROR_GENERAL; 5504 JNIEnv *env;
5505 int retval = DW_ERROR_GENERAL;
5506
5507 if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key)))
5508 {
5509 // First get the class that contains the method you need to call
5510 jclass clazz = _dw_find_class(env, DW_CLASS_NAME);
5511 // Get the method that you want to call
5512 jmethodID windowDestroy = env->GetMethodID(clazz, "windowDestroy",
5513 "(Landroid/view/View;)I");
5514 // Call the method on the object
5515 retval = env->CallIntMethod(_dw_obj, windowDestroy, handle);
5516 _dw_jni_check_exception(env);
5517 }
5518 return retval;
5505 } 5519 }
5506 5520
5507 /* 5521 /*
5508 * Gets the text used for a given window. 5522 * Gets the text used for a given window.
5509 * Parameters: 5523 * Parameters: