[Android] checkMainThread tool method

Geoffrey Métais git at videolan.org
Thu Jan 5 10:16:26 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jan  4 15:55:34 2017 +0100| [7656769311faf33327e28e856cb931c351a1d063] | committer: Geoffrey Métais

checkMainThread tool method

> https://code.videolan.org/videolan/vlc-android/commit/7656769311faf33327e28e856cb931c351a1d063
---

 vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
index 463fdab..e1fc507 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
@@ -244,4 +244,9 @@ public class UiTools {
         savePlaylistDialog.setArguments(args);
         savePlaylistDialog.show(activity.getSupportFragmentManager(), "fragment_add_to_playlist");
     }
+
+    public static void checkMainThread() {
+        if (Looper.getMainLooper() != Looper.myLooper())
+            throw new IllegalThreadStateException();
+    }
 }



More information about the Android mailing list