diff --git a/src/axp/tool/apkextractor/ApkListAdapter.java b/src/axp/tool/apkextractor/ApkListAdapter.java index a945903..a4962e1 100644 --- a/src/axp/tool/apkextractor/ApkListAdapter.java +++ b/src/axp/tool/apkextractor/ApkListAdapter.java @@ -22,12 +22,22 @@ import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; public class ApkListAdapter extends RecyclerView.Adapter { + private ThreadFactory tFactory = new ThreadFactory() { + @Override + public Thread newThread(Runnable r) { + Thread t = new Thread(r); + t.setDaemon(true); + return t; + } + }; + private ArrayList list = new ArrayList(); private ArrayList list_original = new ArrayList(); - private ExecutorService executorServiceNames = Executors.newFixedThreadPool(3); - private ExecutorService executorServiceIcons = Executors.newFixedThreadPool(3); + private ExecutorService executorServiceNames = Executors.newFixedThreadPool(3, tFactory); + private ExecutorService executorServiceIcons = Executors.newFixedThreadPool(3, tFactory); private Handler handler = new Handler(); public MainActivity mActivity; public final PackageManager packageManager; @@ -58,7 +68,10 @@ public void run() { @Override public void run() { names_to_load--; - if (names_to_load == 0) mActivity.hideProgressBar(); + if (names_to_load == 0) { + mActivity.hideProgressBar(); + executorServiceNames.shutdown(); + } } }); }