Download queue in Android

前端 未结 4 512
一生所求
一生所求 2021-02-02 03:22

What\'s the best way to implement a download queue in Android?

I suspect there might be some platform classes that might do most of the work.

4条回答
  •  别那么骄傲
    2021-02-02 03:51

    I would suggest looking at the java.util.concurrent package and more specifically read up on Executors

    You can create an ExecutorService which would only run 'n' number of Runnable objects at a time and would automatically queue up the rest of the tasks. Once one of the threads being executed finishes execution it picks up the next Runnable object in queue for execution.

提交回复
热议问题