[Android] Avoid CalledFromWrongThreadException

Geoffrey Métais git at videolan.org
Fri Feb 27 18:06:09 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Feb 27 18:04:51 2015 +0100| [7405c1985b097b121ce8454488166b96434bfde2] | committer: Geoffrey Métais

Avoid CalledFromWrongThreadException

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index dde9e30..214f8c1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -420,9 +420,9 @@ public class VideoGridFragment extends BrowserFragment implements ISortable, IVi
                 @Override
                 public void run() {
                     if (mGroup != null || itemList.size() <= 10) {
-                        mVideoAdapter.setNotifyOnChange(false);
                         for (MediaWrapper item : itemList) {
                             if (mGroup == null || item.getTitle().startsWith(mGroup)) {
+                                mVideoAdapter.setNotifyOnChange(false);
                                 mVideoAdapter.add(item);
                                 if (mThumbnailer != null)
                                     mThumbnailer.addJob(item);
@@ -431,8 +431,8 @@ public class VideoGridFragment extends BrowserFragment implements ISortable, IVi
                     }
                     else {
                         List<MediaGroup> groups = MediaGroup.group(itemList);
-                        mVideoAdapter.setNotifyOnChange(false);
                         for (MediaGroup item : groups) {
+                            mVideoAdapter.setNotifyOnChange(false);
                             mVideoAdapter.add(item.getMedia());
                             if (mThumbnailer != null)
                                 mThumbnailer.addJob(item);



More information about the Android mailing list