[Android] Use application threadpool in image loader

Geoffrey Métais git at videolan.org
Thu Feb 18 11:14:51 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Feb 18 11:03:48 2016 +0100| [c0e1bef0974e3a3e792751b3d2efd84bf28c8695] | committer: Geoffrey Métais

Use application threadpool in image loader

> https://code.videolan.org/videolan/vlc-android/commit/c0e1bef0974e3a3e792751b3d2efd84bf28c8695
---

 .../src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java       | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java b/vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java
index 40dbb9d..1ff23cf 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/AsyncImageLoader.java
@@ -34,9 +34,6 @@ import org.videolan.vlc.BR;
 import org.videolan.vlc.VLCApplication;
 
 import java.util.concurrent.Callable;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
 
 public class AsyncImageLoader {
 
@@ -47,12 +44,8 @@ public class AsyncImageLoader {
 
     public final static String TAG = "VLC/AsyncImageLoader";
 
-    /* Maximum one thread that is killed after 2 seconds of inactivity */
-    static ThreadPoolExecutor sThreadPool = new ThreadPoolExecutor(0, 1, 2, TimeUnit.SECONDS,
-                                                                   new LinkedBlockingQueue<Runnable>());
-
     public static void LoadImage(final Callbacks cbs, final View target){
-        sThreadPool.execute(new Runnable() {
+        VLCApplication.runBackground(new Runnable() {
             @Override
             public void run() {
                 final Bitmap bitmap = cbs.getImage();



More information about the Android mailing list