[Android] Post UI update from Main thread

Geoffrey Métais git at videolan.org
Mon Aug 10 12:25:38 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Aug  7 17:08:19 2015 +0200| [d0a4f60badf51545a86ba20a638d8b80ac6e6d1b] | committer: Geoffrey Métais

Post UI update from Main thread

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

 .../tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java    |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index 7dbeb08..58bc503 100644
--- a/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -322,6 +322,7 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
 
     public class AsyncUpdate extends AsyncTask<Void, Void, Void> {
         private boolean askRefresh = false;
+        ArrayList<MediaWrapper> videoList;
 
         public AsyncUpdate() {
         }
@@ -378,7 +379,12 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
 
         @Override
         protected Void doInBackground(Void... params) {
-            final ArrayList<MediaWrapper> videoList = mMediaLibrary.getVideoItems();
+            videoList = mMediaLibrary.getVideoItems();
+            return null;
+        }
+
+        @Override
+        protected void onPostExecute(Void result) {
             int size;
             // Update video section
             if (!videoList.isEmpty()) {
@@ -398,11 +404,6 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
                     }
                 });
             }
-            return null;
-        }
-
-        @Override
-        protected void onPostExecute(Void result) {
             if (!mMediaLibrary.isWorking())
                 mProgressBar.setVisibility(View.GONE);
             if (askRefresh) { //in case new event occured while loading view



More information about the Android mailing list