I want to implement a background queue. It works as: when user click a button, add a task (this task need time to be done) to the queue, queue should run on the background thread. If user click button again, add another task in the queue. The background thread runs the tasks in the queue one by one until the queue is empty. I want it only be 1 background thread working on the task. What kind of android feature I can use? or is there any example?
Check out using AsyncTask with a SingleThreadExecuter.
http://developer.android.com/reference/java/util/concurrent/Executors.html#newSingleThreadExecutor()
Creates an Executor that uses a single worker thread operating off an unbounded queue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With