From 4b1b5881b09f358eb9c9cf2310d8803244de46e7 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 15 Aug 2023 13:57:10 +0200 Subject: [PATCH] Android: Move DirectoryInitialization toast to UI thread You're not allowed to just show toasts on any thread you want. --- .../dolphinemu/utils/DirectoryInitialization.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/DirectoryInitialization.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/DirectoryInitialization.java index 15d226afd4..1d7342372f 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/DirectoryInitialization.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/DirectoryInitialization.java @@ -14,6 +14,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.content.ContextCompat; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.preference.PreferenceManager; @@ -73,8 +74,12 @@ public final class DirectoryInitialization if (!setDolphinUserDirectory(context)) { - Toast.makeText(context, R.string.external_storage_not_mounted, Toast.LENGTH_LONG).show(); - System.exit(1); + ContextCompat.getMainExecutor(context).execute(() -> + { + Toast.makeText(context, R.string.external_storage_not_mounted, Toast.LENGTH_LONG).show(); + System.exit(1); + }); + return; } extractSysDirectory(context);