[Android] VideoPlayerActivity: map the track position to list position

Edward Wang git at videolan.org
Fri Jan 18 01:24:29 CET 2013


vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Jan 17 19:20:43 2013 -0500| [6685fe08d557f7fa7accb7cca88d5bddce15f25c] | committer: Edward Wang

VideoPlayerActivity: map the track position to list position

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

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java      |    6 +++++-
 1 file changed, 5 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 2dda375..0c73ff6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -924,13 +924,17 @@ public class VideoPlayerActivity extends Activity {
         public void onClick(View v) {
             final String[] arrList = new String[mAudioTracksList.size()];
             int i = 0;
+            int listPosition = 0;
             for(Map.Entry<Integer,String> entry : mAudioTracksList.entrySet()) {
                 arrList[i] = entry.getValue();
+                // map the track position to the list position
+                if(entry.getKey() == mLibVLC.getAudioTrack())
+                    listPosition = i;
                 i++;
             }
             AlertDialog dialog = new AlertDialog.Builder(VideoPlayerActivity.this)
             .setTitle(R.string.track_audio)
-            .setSingleChoiceItems(arrList, mLibVLC.getAudioTrack(), new DialogInterface.OnClickListener() {
+            .setSingleChoiceItems(arrList, listPosition, new DialogInterface.OnClickListener() {
                 @Override
                 public void onClick(DialogInterface dialog, int listPosition) {
                     int trackID = -1;



More information about the Android mailing list