From 5f35cf7b232f94819a07098b82b34dac796d156f Mon Sep 17 00:00:00 2001 From: dankito Date: Tue, 6 Oct 2020 16:56:57 +0200 Subject: [PATCH] Fixed that listeners get called off UI thread --- .../dankito/banking/ui/android/util/CurrentActivityTracker.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/util/CurrentActivityTracker.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/util/CurrentActivityTracker.kt index a3e7136a..916a28d6 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/util/CurrentActivityTracker.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/util/CurrentActivityTracker.kt @@ -43,7 +43,9 @@ open class CurrentActivityTracker { nextActivitySetListeners.clear() Timer().schedule(500) { // wait some time till activity is initialized - listenersCopy.forEach { it(activity) } + activity.runOnUiThread { + listenersCopy.forEach { it(activity) } + } } } }