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

Thomas Guillem git at videolan.org
Thu Mar 19 09:19:03 CET 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Mar 18 16:43:11 2015 +0100| [98bee5ff38ca1be1dccff639a7c09ad9b4df7357] | committer: Thomas Guillem

VideoPlayer: fix track selection when they have the same name

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

Fixes #13644

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=98bee5ff38ca1be1dccff639a7c09ad9b4df7357
---

 .../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 dbeb9d2..397c90a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1977,9 +1977,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)
@@ -1995,7 +1997,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;
                             }



More information about the Android mailing list