SDL: better to terminate the activity

From ca10f7c6b1bb1e55034714c345da80c2712acbc6 Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Thu, 6 Apr 2023 22:46:21 +0200
Subject: [PATCH] better to terminate the activity

---
 .../app/src/main/java/org/libsdl/app/SDLActivity.java        | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
index ff38a337ddbc..76634143f086 100644
--- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
+++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
@@ -330,8 +330,9 @@ protected void onCreate(Bundle savedInstanceState) {
         if (mIsFinishing != 0 && mIsFinishing < 5) {
             Log.v(TAG, "finish activity");
             mIsFinishing += 1;
-            /* Make it clear the activity has to be destroyed, even if finish() seems not to be required here */
-            finish();
+            /* We need to terminate the activity because SDL main() ended before.
+             * It seems that this exits correctly, but launcher also immediately recreates an activity */
+            System.exit(0);
             return;
         }