comparison android/dw.cpp @ 2487:83f8f4f58a98

Android: Implement dw_exit() using Activity.finishActivity() instead of exit().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 27 Apr 2021 09:19:29 +0000
parents cec43818bd3e
children 666af45f33b5
comparison
equal deleted inserted replaced
2486:cec43818bd3e 2487:83f8f4f58a98
471 * Parameters: 471 * Parameters:
472 * exitcode: Exit code reported to the operating system. 472 * exitcode: Exit code reported to the operating system.
473 */ 473 */
474 void API dw_exit(int exitcode) 474 void API dw_exit(int exitcode)
475 { 475 {
476 JNIEnv *env;
477
478 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key)))
479 {
480 // First get the class that contains the method you need to call
481 jclass clazz = _dw_find_class(env, DW_CLASS_NAME);
482 // Get the method that you want to call
483 jmethodID dwindowsExit = env->GetMethodID(clazz, "dwindowsExit",
484 "(I)V");
485 // Call the method on the object
486 env->CallVoidMethod(_dw_obj, dwindowsExit, exitcode);
487 }
476 exit(exitcode); 488 exit(exitcode);
477 } 489 }
478 490
479 /* 491 /*
480 * Free's memory allocated by dynamic windows. 492 * Free's memory allocated by dynamic windows.