diff --git a/base/src/main/java/de/staropensource/sosengine/base/utility/Miscellaneous.java b/base/src/main/java/de/staropensource/sosengine/base/utility/Miscellaneous.java index 7cccd01..6528576 100644 --- a/base/src/main/java/de/staropensource/sosengine/base/utility/Miscellaneous.java +++ b/base/src/main/java/de/staropensource/sosengine/base/utility/Miscellaneous.java @@ -163,4 +163,14 @@ public final class Miscellaneous { return separator; return null; } + + /** + * Ensures that the code is running on the main thread. + * + * @return {@code true} if running on the main thread, {@code false} otherwise + * @since v1-alpha2 + */ + public static boolean onMainThread() { + return Thread.currentThread().threadId() == 1; + } }