[Android] AudioBrowserList: run addAll on uiThread

Thomas Guillem git at videolan.org
Tue Oct 6 18:32:35 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Oct  6 18:31:41 2015 +0200| [4138222cf7863fd88f29211c1099a64b66c76f8d] | committer: Thomas Guillem

AudioBrowserList: run addAll on uiThread

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

 .../vlc/gui/audio/AudioBrowserListAdapter.java        |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
index 1c538a2..1abeec2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
@@ -117,12 +117,17 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
         mAlignMode = Integer.valueOf(preferences.getString("audio_title_alignment", "0"));
     }
 
-    public void addAll(List<ListItem> items) {
-        for (ListItem item : items) {
-            mMediaItemMap.put(item.mTitle, item);
-            mItems.add(item);
-        }
-        Collections.sort(mItems, mItemsComparator);
+    public void addAll(final List<ListItem> items) {
+        mContext.runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                for (ListItem item : items) {
+                    mMediaItemMap.put(item.mTitle, item);
+                    mItems.add(item);
+                }
+                Collections.sort(mItems, mItemsComparator);
+            }
+        });
     }
 
     public void add(String title, String subTitle, MediaWrapper media) {



More information about the Android mailing list