[Android] Specify main looper for monitor handler

Geoffrey Métais git at videolan.org
Tue Jan 16 15:38:32 CET 2018


vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 16 15:22:42 2018 +0100| [991816300652612f7b79c1cc466c75211fe0fa87] | committer: Geoffrey Métais

Specify main looper for monitor handler

(cherry picked from commit 74f5939aac2c2d32163b53b34644a9d21fb020c7)

> https://code.videolan.org/videolan/vlc-android/commit/991816300652612f7b79c1cc466c75211fe0fa87
---

 vlc-android/src/org/videolan/vlc/ExternalMonitor.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
index bb4187807..43efdf2c2 100644
--- a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
+++ b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
@@ -34,6 +34,7 @@ import android.net.NetworkCapabilities;
 import android.net.NetworkInfo;
 import android.net.Uri;
 import android.os.Handler;
+import android.os.Looper;
 import android.os.Message;
 import android.support.v4.content.LocalBroadcastManager;
 import android.support.v7.preference.PreferenceManager;
@@ -125,7 +126,7 @@ public class ExternalMonitor extends BroadcastReceiver {
 
     private static final int ACTION_MEDIA_MOUNTED = 1337;
     private static final int ACTION_MEDIA_UNMOUNTED = 1338;
-    private Handler mHandler = new Handler() {
+    private final Handler mHandler = new Handler(Looper.getMainLooper()) {
         @Override
         public void handleMessage(Message msg) {
             final Context appCtx = VLCApplication.getAppContext();



More information about the Android mailing list