[Android] [PATCH 2/2] VideoPlayer: fix track selection when they have the same name

Thomas Guillem thomas at gllm.fr
Wed Mar 18 16:44:17 CET 2015


Compare with the id of the track, not the name.

Fixes #13644
---
 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index ddb364a..989f1b6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1967,9 +1967,11 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
         if (trackMap == null)
             return;
         final String[] nameList = new String[trackMap.size()];
+        final int[] idList = new int[trackMap.size()];
         int i = 0;
         int listPosition = 0;
         for(Map.Entry<Integer,String> entry : trackMap.entrySet()) {
+            idList[i] = entry.getKey();
             nameList[i] = entry.getValue();
             // map the track position to the list position
             if(entry.getKey() == currentTrack)
@@ -1985,7 +1987,7 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
                         int trackID = -1;
                         // Reverse map search...
                         for (Map.Entry<Integer, String> entry : trackMap.entrySet()) {
-                            if (nameList[listPosition].equals(entry.getValue())) {
+                            if (idList[listPosition] == entry.getKey()) {
                                 trackID = entry.getKey();
                                 break;
                             }
-- 
2.1.3



More information about the Android mailing list