[Android] Specify main looper for monitor handler

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


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

Specify main looper for monitor handler

> https://code.videolan.org/videolan/vlc-android/commit/74f5939aac2c2d32163b53b34644a9d21fb020c7
---

 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 1840bf80d..b61570353 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;
@@ -126,7 +127,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